From ed4e9e26b77ec8de85e3d240371a16ad227a852d Mon Sep 17 00:00:00 2001 From: Oleksandr Date: Tue, 26 Nov 2024 21:39:40 +0200 Subject: [PATCH] Solution --- db/models.py | 2 +- main.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/db/models.py b/db/models.py index dc931c25..4f0b03fa 100644 --- a/db/models.py +++ b/db/models.py @@ -7,4 +7,4 @@ class Genre(models.Model): class Actor(models.Model): first_name = models.CharField(max_length=255) - last_name = models.CharField(max_length=255) + last_name = models.CharField(max_length=255) \ No newline at end of file diff --git a/main.py b/main.py index c91effff..c4c15654 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,6 @@ import init_django_orm # noqa: F401 from django.db.models import QuerySet - from db.models import Genre, Actor @@ -10,8 +9,8 @@ def main() -> QuerySet: genres = ["Western", "Action", "Dramma"] actors = [ - ("George Klooney", "Kianu Reaves", "Scarlett Keegan"), - ("Will Smith", "Jaden Smith", "Scarlett Johansson") + ("George", "Klooney"), ("Kianu", "Reaves"), ("Scarlett", "Keegan"), + ("Will", "Smith"), ("Jaden", "Smith"), ("Scarlett", "Johansson") ] for genre in genres: @@ -24,10 +23,8 @@ def main() -> QuerySet: Actor.objects.filter(first_name="George", last_name="Klooney").update( last_name="Clooney" ) - Actor.objects.filter( - first_name="Kianu", last_name="Reaves" - ).update( - first_name="Keanu", last_name="Reevas") + Actor.objects.filter(first_name="Kianu", last_name="Reaves").update( + first_name="Keanu", last_name="Reeves") Genre.objects.filter(name="Action").delete() Actor.objects.filter(first_name="Scarlett").delete()