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
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-04-03 01:20:54 +02:00
|
|
|
class Film(models.Model):
|
2022-04-03 01:20:53 +02:00
|
|
|
class MovieFormat(models.TextChoices):
|
2022-04-03 01:20:54 +02:00
|
|
|
ANALOG_35 = "35mm"
|
2022-04-09 02:48:03 +02:00
|
|
|
DIGITAL = "Numérique"
|
2022-04-03 01:20:53 +02:00
|
|
|
|
|
|
|
class LanguageSubtitles(models.TextChoices):
|
2022-04-03 01:20:54 +02:00
|
|
|
FRENCH = "VOF"
|
|
|
|
FOREIGN = "VOSTFR"
|
2022-04-03 01:20:53 +02:00
|
|
|
|
2022-04-09 00:34:47 +02:00
|
|
|
projection_date = models.DateTimeField(null=True, blank=True)
|
2022-04-03 01:20:53 +02:00
|
|
|
title = models.CharField(max_length=60)
|
2022-04-03 01:20:54 +02:00
|
|
|
actors = models.JSONField(default=list)
|
2022-04-09 00:34:47 +02:00
|
|
|
director = models.CharField(max_length=60, null=True, blank=True)
|
|
|
|
duration = models.DurationField(null=True, blank=True)
|
|
|
|
synopsis = models.TextField(null=True, blank=True)
|
|
|
|
origin_country = models.CharField(max_length=60, null=True, blank=True)
|
|
|
|
release_year = models.SmallIntegerField(null=True, blank=True)
|
|
|
|
trailer_link = models.URLField(null=True, blank=True)
|
|
|
|
is_in_color = models.BooleanField(null=True, blank=True)
|
2022-07-14 06:05:35 +02:00
|
|
|
movie_format = models.CharField(
|
|
|
|
max_length=20, choices=MovieFormat.choices, null=True, blank=True
|
|
|
|
)
|
2022-04-03 01:20:54 +02:00
|
|
|
language_subtitles = models.CharField(
|
2022-07-14 06:05:35 +02:00
|
|
|
max_length=20, choices=LanguageSubtitles.choices, null=True, blank=True
|
2022-04-03 01:20:54 +02:00
|
|
|
)
|
2022-04-09 00:34:47 +02:00
|
|
|
poster_link = models.URLField(null=True, blank=True)
|
|
|
|
banner_link = models.URLField(null=True, blank=True)
|
2022-04-03 01:20:53 +02:00
|
|
|
is_confirmed = models.BooleanField(default=False)
|
2022-06-10 00:22:06 +02:00
|
|
|
imdb_id = models.CharField(max_length=10, null=True, blank=True)
|
|
|
|
tmdb_id = models.IntegerField(null=True, blank=True)
|
2022-07-13 02:18:06 +02:00
|
|
|
facebook_event_link = models.URLField(null=True, blank=True)
|
2022-04-03 01:20:53 +02:00
|
|
|
|
|
|
|
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-07-13 02:18:06 +02:00
|
|
|
|
|
|
|
def is_publishable(self):
|
|
|
|
return (
|
|
|
|
self.title is not None
|
|
|
|
and self.poster_link is not None
|
|
|
|
and self.projection_date is not None
|
|
|
|
)
|