cineclub-site/server/myapi/models.py

38 lines
1.1 KiB
Python
Raw Normal View History

2022-04-03 01:20:53 +02:00
from django.db import models
2022-04-03 01:20:53 +02:00
"""
TODO implement validators
- nullable or sure
"""
class Film(models.Model):
class MovieFormat(models.TextChoices):
ANALOG_35 = '35mm'
DVD = 'DVD'
BLU_RAY = 'Blu ray'
class LanguageSubtitles(models.TextChoices):
FRENCH = 'VOF'
FOREIGN = 'VOSTFR'
projection_date = models.DateTimeField()
title = models.CharField(max_length=60)
2022-04-03 01:20:54 +02:00
actors = models.JSONField(default=list)
2022-04-03 01:20:53 +02:00
director = models.CharField(max_length=60)
duration = models.DurationField()
synopsis = models.TextField()
origin_country = models.CharField(max_length=60)
release_year = models.SmallIntegerField()
trailer_link = models.URLField()
is_in_color = models.BooleanField()
movie_format = models.CharField(max_length=20, choices=MovieFormat.choices)
language_subtitles = models.CharField(max_length=20, choices=LanguageSubtitles.choices)
poster_link = models.URLField()
banner_link = models.URLField()
is_confirmed = models.BooleanField(default=False)
def __str__(self):
2022-04-03 01:20:54 +02:00
return f'{self.title} de {self.director} ({self.projection_date.strftime("%d/%m/%Y")})'
2022-04-03 01:20:53 +02:00