Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
AchillesPython committed Nov 26, 2024
1 parent 0920959 commit ed4e9e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 4 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import init_django_orm # noqa: F401

from django.db.models import QuerySet

from db.models import Genre, Actor


Expand All @@ -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:
Expand All @@ -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()
Expand Down

0 comments on commit ed4e9e2

Please sign in to comment.