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 = {
id: number
projectionDate: Date
title: string
actors: string[]
director: string
duration: number
synopsis: string
originCountry: string
releaseYear: number
trailerLink: string
isInColor: boolean
movieFormat: Format
languageSubtitles: LanguageSubtitles
posterLink: string
bannerLink: string
isConfirmed: boolean
id?: number
projectionDate?: Date
title?: string
actors?: string[]
director?: string
duration?: number
synopsis?: string
originCountry?: string
releaseYear?: number
trailerLink?: string
isInColor?: boolean
movieFormat?: Format
languageSubtitles?: LanguageSubtitles
posterLink?: string
bannerLink?: string
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"
FOREIGN = "VOSTFR"
projection_date = models.DateTimeField()
projection_date = models.DateTimeField(null=True, blank=True)
title = models.CharField(max_length=60)
actors = models.JSONField(default=list)
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)
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)
movie_format = models.CharField(max_length=20, choices=MovieFormat.choices, null=True, blank=True)
language_subtitles = models.CharField(
max_length=20, choices=LanguageSubtitles.choices
max_length=20, choices=LanguageSubtitles.choices,
null=True, blank=True
)
poster_link = models.URLField()
banner_link = models.URLField()
poster_link = models.URLField(null=True, blank=True)
banner_link = models.URLField(null=True, blank=True)
is_confirmed = models.BooleanField(default=False)
def __str__(self):