from django.db import models # Create your models here. class Party(models.Model): name = models.CharField( max_length=50, #unique=True, ) description = models.CharField( null=True, blank=True, max_length=200, ) location = models.ForeignKey( 'Location', on_delete=models.PROTECT, ) doors_open = models.DateTimeField( null=True, blank=True, ) doors_close = models.DateTimeField( null=True, blank=True, ) price = models.DecimalField( decimal_places=2, max_digits=5, ) wardrobe = models.DecimalField( null=True, default=None, decimal_places=2, max_digits=4, ) wardrobe_guarded = models.BooleanField( default=False ) dresscode = models.CharField( max_length=50, ) area = models.ForeignKey( 'Area', on_delete=models.CASCADE, ) class Location(models.Model): name = models.CharField( max_length=50, ) venue_type = models.CharField( max_length=30, ) street = models.CharField( max_length=50, ) housenumber = models.CharField( max_length=10, ) city = models.CharField( max_length=30, ) areacode = models.CharField( null=True, blank=True, max_length=10 ) free_parking = models.PositiveSmallIntegerField( default=False, ) class Meta: #db_table = 'app_version' constraints = [ models.UniqueConstraint(fields=['street', 'housenumber'], name='unique location') ] class Area(models.Model): name = models.CharField( max_length=50, default='Main', ) activity = models.ForeignKey( 'Activity', on_delete=models.CASCADE, ) class Activity(models.Model): name = models.CharField( null=True, blank=True, max_length=50, default='Social', ) description = models.CharField( null=True, blank=True, max_length=200, ) TYPE_CHOICES = [ ('Dance party', ( ('sc', 'Social'), ('gl', 'Gala'), ) ), ('ws', 'Workshop'), ('sh', 'Show'), ('br', 'Break'), ('ot', 'Other'), ] type = models.CharField( max_length=2, choices=TYPE_CHOICES, default='sc', ) start = models.DateTimeField() end = models.DateTimeField() artist = models.CharField( null=True, blank=True, max_length=50, )