update
This commit is contained in:
@@ -2,6 +2,11 @@ from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
|
||||
class Institute(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Betriebskosten(models.Model):
|
||||
KOSTENTYP_CHOICES = [
|
||||
@@ -30,9 +35,10 @@ class Betriebskosten(models.Model):
|
||||
class Client(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
address = models.TextField()
|
||||
|
||||
institute = models.ForeignKey(Institute, on_delete=models.CASCADE) # Remove null=True, blank=True
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
return f"{self.name} ({self.institute.name})"
|
||||
|
||||
class ExcelEntry(models.Model):
|
||||
client = models.ForeignKey(Client, on_delete=models.CASCADE)
|
||||
@@ -52,23 +58,65 @@ class ExcelEntry(models.Model):
|
||||
notes = models.TextField(blank=True, null=True)
|
||||
date_joined = models.DateField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.client.name} - {self.date}"
|
||||
# Manual input
|
||||
lhe_zus = models.DecimalField(
|
||||
max_digits=10,
|
||||
decimal_places=3,
|
||||
validators=[MinValueValidator(0)],
|
||||
default=0.0
|
||||
)
|
||||
|
||||
druckkorrektur = models.DecimalField(
|
||||
max_digits=10,
|
||||
decimal_places=3,
|
||||
validators=[MinValueValidator(0)],
|
||||
default=1.0
|
||||
)
|
||||
|
||||
# Auto-calculated values (saved)
|
||||
constant_300 = models.DecimalField(
|
||||
max_digits=10,
|
||||
decimal_places=3,
|
||||
default=300.0
|
||||
)
|
||||
|
||||
korrig_druck = models.DecimalField(
|
||||
max_digits=12,
|
||||
decimal_places=6,
|
||||
default=0.0
|
||||
)
|
||||
|
||||
nm3 = models.DecimalField(
|
||||
max_digits=12,
|
||||
decimal_places=6,
|
||||
default=0.0
|
||||
)
|
||||
|
||||
lhe = models.DecimalField(
|
||||
max_digits=12,
|
||||
decimal_places=6,
|
||||
default=0.0
|
||||
)
|
||||
|
||||
lhe_ges = models.DecimalField(
|
||||
max_digits=12,
|
||||
decimal_places=6,
|
||||
default=0.0
|
||||
)
|
||||
class SecondTableEntry(models.Model):
|
||||
client = models.ForeignKey(Client, on_delete=models.CASCADE)
|
||||
date = models.DateField(default=timezone.now) # Added default value
|
||||
date = models.DateField(default=timezone.now)
|
||||
is_warm = models.BooleanField(default=False)
|
||||
lhe_delivery = models.CharField(max_length=100, blank=True, null=True)
|
||||
lhe_output = models.DecimalField(
|
||||
max_digits=10,
|
||||
decimal_places=2,
|
||||
validators=[MinValueValidator(0)],
|
||||
blank=True,
|
||||
null=True
|
||||
max_digits=10,
|
||||
decimal_places=2,
|
||||
validators=[MinValueValidator(0)],
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
notes = models.TextField(blank=True, null=True)
|
||||
date_joined = models.DateField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.client.name} - {self.date}"
|
||||
return f"{self.client.name} - {self.date}"
|
||||
Reference in New Issue
Block a user