diff --git a/cinema/fixtures/cinema_service_db_data.json b/cinema/fixtures/cinema_service_db_data.json new file mode 100644 index 000000000..e0e74af12 --- /dev/null +++ b/cinema/fixtures/cinema_service_db_data.json @@ -0,0 +1,37 @@ +[ + { + "model": "cinema.actor", + "pk": 1, + "fields": { + "first_name": "Leonardo", + "last_name": "DiCaprio" + } + }, + { + "model": "cinema.genre", + "pk": 1, + "fields": { + "name": "Drama" + } + }, + { + "model": "cinema.cinemahall", + "pk": 1, + "fields": { + "name": "Main Hall", + "rows": 10, + "seats_in_row": 20 + } + }, + { + "model": "cinema.movie", + "pk": 1, + "fields": { + "title": "Inception", + "description": "A mind-bending thriller", + "duration": 148, + "actors": [1], + "genres": [1] + } + } +] diff --git a/cinema/migrations/0002_actor_cinemahall_genre_movie_actors_movie_genres.py b/cinema/migrations/0002_actor_cinemahall_genre_movie_actors_movie_genres.py new file mode 100644 index 000000000..2ce6633ed --- /dev/null +++ b/cinema/migrations/0002_actor_cinemahall_genre_movie_actors_movie_genres.py @@ -0,0 +1,71 @@ +# Generated by Django 4.1 on 2024-12-19 18:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("cinema", "0001_initial"), + ] + + operations = [ + migrations.CreateModel( + name="Actor", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("first_name", models.CharField(max_length=50)), + ("last_name", models.CharField(max_length=50)), + ], + ), + migrations.CreateModel( + name="CinemaHall", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=100)), + ("rows", models.PositiveIntegerField()), + ("seats_in_row", models.PositiveIntegerField()), + ], + ), + migrations.CreateModel( + name="Genre", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=100, unique=True)), + ], + ), + migrations.AddField( + model_name="movie", + name="actors", + field=models.ManyToManyField(related_name="movies", to="cinema.actor"), + ), + migrations.AddField( + model_name="movie", + name="genres", + field=models.ManyToManyField(related_name="movies", to="cinema.genre"), + ), + ]