feat [full]: allow uncomplete films

This commit is contained in:
Alice 2022-04-09 00:34:47 +02:00
parent 7cbf25a643
commit 07fc80d04a
3 changed files with 102 additions and 28 deletions

View file

@ -9,20 +9,20 @@ export enum LanguageSubtitles {
} }
export type Film = { export type Film = {
id: number id?: number
projectionDate: Date projectionDate?: Date
title: string title?: string
actors: string[] actors?: string[]
director: string director?: string
duration: number duration?: number
synopsis: string synopsis?: string
originCountry: string originCountry?: string
releaseYear: number releaseYear?: number
trailerLink: string trailerLink?: string
isInColor: boolean isInColor?: boolean
movieFormat: Format movieFormat?: Format
languageSubtitles: LanguageSubtitles languageSubtitles?: LanguageSubtitles
posterLink: string posterLink?: string
bannerLink: string bannerLink?: string
isConfirmed: boolean isConfirmed?: boolean
} }

View file

@ -0,0 +1,73 @@
# Generated by Django 4.0.3 on 2022-04-08 20:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapi', '0002_alter_film_actors'),
]
operations = [
migrations.AlterField(
model_name='film',
name='banner_link',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='director',
field=models.CharField(blank=True, max_length=60, null=True),
),
migrations.AlterField(
model_name='film',
name='duration',
field=models.DurationField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='is_in_color',
field=models.BooleanField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='language_subtitles',
field=models.CharField(blank=True, choices=[('VOF', 'French'), ('VOSTFR', 'Foreign')], max_length=20, null=True),
),
migrations.AlterField(
model_name='film',
name='movie_format',
field=models.CharField(blank=True, choices=[('35mm', 'Analog 35'), ('DVD', 'Dvd'), ('Blu ray', 'Blu Ray')], max_length=20, null=True),
),
migrations.AlterField(
model_name='film',
name='origin_country',
field=models.CharField(blank=True, max_length=60, null=True),
),
migrations.AlterField(
model_name='film',
name='poster_link',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='projection_date',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='release_year',
field=models.SmallIntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='synopsis',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='film',
name='trailer_link',
field=models.URLField(blank=True, null=True),
),
]

View file

@ -16,22 +16,23 @@ class Film(models.Model):
FRENCH = "VOF" FRENCH = "VOF"
FOREIGN = "VOSTFR" FOREIGN = "VOSTFR"
projection_date = models.DateTimeField() projection_date = models.DateTimeField(null=True, blank=True)
title = models.CharField(max_length=60) title = models.CharField(max_length=60)
actors = models.JSONField(default=list) actors = models.JSONField(default=list)
director = models.CharField(max_length=60) director = models.CharField(max_length=60, null=True, blank=True)
duration = models.DurationField() duration = models.DurationField(null=True, blank=True)
synopsis = models.TextField() synopsis = models.TextField(null=True, blank=True)
origin_country = models.CharField(max_length=60) origin_country = models.CharField(max_length=60, null=True, blank=True)
release_year = models.SmallIntegerField() release_year = models.SmallIntegerField(null=True, blank=True)
trailer_link = models.URLField() trailer_link = models.URLField(null=True, blank=True)
is_in_color = models.BooleanField() is_in_color = models.BooleanField(null=True, blank=True)
movie_format = models.CharField(max_length=20, choices=MovieFormat.choices) movie_format = models.CharField(max_length=20, choices=MovieFormat.choices, null=True, blank=True)
language_subtitles = models.CharField( language_subtitles = models.CharField(
max_length=20, choices=LanguageSubtitles.choices max_length=20, choices=LanguageSubtitles.choices,
null=True, blank=True
) )
poster_link = models.URLField() poster_link = models.URLField(null=True, blank=True)
banner_link = models.URLField() banner_link = models.URLField(null=True, blank=True)
is_confirmed = models.BooleanField(default=False) is_confirmed = models.BooleanField(default=False)
def __str__(self): def __str__(self):