From 04996ac7101d5be8949be7bc9de577b3117cd5ed Mon Sep 17 00:00:00 2001 From: yura Date: Mon, 18 Nov 2024 20:24:43 +0200 Subject: [PATCH] fixed sorting by last_name --- main.py | 3 ++- settings.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 046a1471..3f6bad45 100644 --- a/main.py +++ b/main.py @@ -15,6 +15,7 @@ def main() -> QuerySet: ("Scarlett", "Johansson") ] + for genre in genres: Genre.objects.create(name=genre) @@ -31,7 +32,7 @@ def main() -> QuerySet: Genre.objects.filter(name="Action").delete() Actor.objects.filter(first_name="Scarlett").delete() - return Actor.objects.all().order_by("first_name") + return Actor.objects.all().order_by("last_name") if __name__ == "__main__": diff --git a/settings.py b/settings.py index 18760dec..dbb19202 100644 --- a/settings.py +++ b/settings.py @@ -3,6 +3,10 @@ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +INSTALLED_APPS = [ + "db" +] + # SECURITY WARNING: Modify this secret key if using in production! SECRET_KEY = "6few3nci_q_o@l1dlbk81%wcxe!*6r29yu629&d97!hiqat9fa"