hackens-orga/hackens_orga/budget/models.py
2023-02-08 02:04:34 +01:00

25 lines
810 B
Python

from datetime import date
from agent.models import Agent
from django.db import models
class BudgetLine(models.Model):
amount = models.DecimalField(max_digits=12, decimal_places=2)
author = models.ForeignKey(Agent, on_delete=models.PROTECT)
comment = models.TextField(blank=True)
date = models.DateField(default=date.today)
facture = models.FileField(upload_to="factures/", null=True, blank=True)
group = models.ForeignKey("BudgetGroup", on_delete=models.CASCADE)
title = models.CharField(max_length=255)
def __str__(self):
return f"BudgetLine_{self.title}_{self.amount}"
class BudgetGroup(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
def __str__(self):
return f"BudgetGroup_{self.name}"