models.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. from django.db import models
  2. # Create your models here.
  3. class Party(models.Model):
  4. name = models.CharField(
  5. max_length=50,
  6. #unique=True,
  7. )
  8. description = models.CharField(
  9. null=True,
  10. blank=True,
  11. max_length=200,
  12. )
  13. location = models.ForeignKey(
  14. 'Location',
  15. on_delete=models.PROTECT,
  16. )
  17. doors_open = models.DateTimeField(
  18. null=True,
  19. blank=True,
  20. )
  21. doors_close = models.DateTimeField(
  22. null=True,
  23. blank=True,
  24. )
  25. price = models.DecimalField(
  26. decimal_places=2,
  27. max_digits=5,
  28. )
  29. wardrobe = models.DecimalField(
  30. null=True,
  31. default=None,
  32. decimal_places=2,
  33. max_digits=4,
  34. )
  35. wardrobe_guarded = models.BooleanField(
  36. default=False
  37. )
  38. dresscode = models.CharField(
  39. max_length=50,
  40. )
  41. area = models.ForeignKey(
  42. 'Area',
  43. on_delete=models.CASCADE,
  44. )
  45. class Location(models.Model):
  46. name = models.CharField(
  47. max_length=50,
  48. )
  49. venue_type = models.CharField(
  50. max_length=30,
  51. )
  52. street = models.CharField(
  53. max_length=50,
  54. )
  55. housenumber = models.CharField(
  56. max_length=10,
  57. )
  58. city = models.CharField(
  59. max_length=30,
  60. )
  61. areacode = models.CharField(
  62. null=True,
  63. blank=True,
  64. max_length=10
  65. )
  66. free_parking = models.PositiveSmallIntegerField(
  67. default=False,
  68. )
  69. class Meta:
  70. #db_table = 'app_version'
  71. constraints = [
  72. models.UniqueConstraint(fields=['street', 'housenumber'], name='unique location')
  73. ]
  74. class Area(models.Model):
  75. name = models.CharField(
  76. max_length=50,
  77. default='Main',
  78. )
  79. activity = models.ForeignKey(
  80. 'Activity',
  81. on_delete=models.CASCADE,
  82. )
  83. class Activity(models.Model):
  84. name = models.CharField(
  85. null=True,
  86. blank=True,
  87. max_length=50,
  88. default='Social',
  89. )
  90. description = models.CharField(
  91. null=True,
  92. blank=True,
  93. max_length=200,
  94. )
  95. TYPE_CHOICES = [
  96. ('Dance party',
  97. (
  98. ('sc', 'Social'),
  99. ('gl', 'Gala'),
  100. )
  101. ),
  102. ('ws', 'Workshop'),
  103. ('sh', 'Show'),
  104. ('br', 'Break'),
  105. ('ot', 'Other'),
  106. ]
  107. type = models.CharField(
  108. max_length=2,
  109. choices=TYPE_CHOICES,
  110. default='sc',
  111. )
  112. start = models.DateTimeField()
  113. end = models.DateTimeField()
  114. artist = models.CharField(
  115. null=True,
  116. blank=True,
  117. max_length=50,
  118. )