models.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. from django.db import models
  2. from django.utils.translation import gettext_lazy as _
  3. # Create your models here.
  4. class Helper(models.Model):
  5. date = models.DateField()
  6. ben = models.PositiveSmallIntegerField()
  7. best = models.PositiveSmallIntegerField(blank=True, null=True)
  8. info = models.TextField(blank=True, null=True)
  9. def __str__(self):
  10. return f"{self.date} - {self.ben} - {self.best}"
  11. class Reinigung(models.Model):
  12. class ShiftType(models.TextChoices):
  13. Beauftragen = 'Beauftragen' # Placeholder for "None" if you're using it
  14. Bestellt = 'Bestellt'
  15. date = models.DateField()
  16. auftrag = models.CharField(
  17. max_length=12,
  18. choices=ShiftType.choices,
  19. default='',
  20. null=True,
  21. )
  22. info = models.TextField(blank=True, null=True)
  23. def __str__(self):
  24. return f"{self.date} - {self.auftrag}"
  25. class Employee(models.Model):
  26. name = models.CharField(max_length=100)
  27. daily_workhours = models.PositiveIntegerField()
  28. info = models.TextField(blank=True, null=True)
  29. def __str__(self):
  30. return self.name
  31. class Shift(models.Model):
  32. class ShiftType(models.TextChoices):
  33. NONE = 'N', _('None') # Placeholder for "None" if you're using it
  34. VACATION = 'U', _('Urlaub')
  35. CATERING = 'C', _('Catering')
  36. SICK = 'K', _('Krank')
  37. RB = 'RB', _('Rufbereitschaft')
  38. SD = 'SO', _('Sonderdienst')
  39. KK = 'KKH', _('KKH')
  40. ST = 'ST', _('Stapler')
  41. AH = 'AH', _('Ausser Haus')
  42. date = models.DateField()
  43. start = models.TimeField(null=True, blank=True)
  44. end = models.TimeField(null=True, blank=True)
  45. shifttype = models.CharField(
  46. max_length=3,
  47. choices=ShiftType.choices,
  48. default=ShiftType.NONE,
  49. null=True,
  50. )
  51. employee = models.ForeignKey(Employee, on_delete=models.CASCADE)
  52. info = models.TextField(null=True, blank=True)
  53. def __str__(self):
  54. return f"{self.date} - {self.get_shifttype_display()}"
  55. class Location(models.Model):
  56. name = models.CharField(max_length=100)
  57. def __str__(self):
  58. return self.name
  59. class Event(models.Model):
  60. class EventType(models.TextChoices):
  61. NONE = '', _('None')
  62. AUFBAU = 'AU', _('Aufbau')
  63. ABBAU = 'AB', _('Abbau')
  64. UMBAU = 'UM', _('Umbau')
  65. VATAG = 'VA', _('VA-Tag')
  66. SPIELTAG = 'ST', _('Spieltag')
  67. TRAINING = 'TR', _('Training')
  68. date = models.DateField()
  69. name = models.CharField(max_length=100)
  70. event_type = models.CharField(
  71. max_length=2,
  72. choices=EventType.choices,
  73. default=EventType.NONE,
  74. null=True,
  75. )
  76. location = models.ForeignKey(Location, on_delete=models.CASCADE)
  77. cvd = models.ForeignKey(Employee, related_name='cvt', on_delete=models.SET_NULL, null=True, blank=True)
  78. cvt = models.ForeignKey(Employee, related_name='cvd', on_delete=models.SET_NULL, null=True, blank=True)
  79. info = models.TextField(null=True, blank=True)
  80. def __str__(self):
  81. return f"{self.date} - {self.name}"