From 2d4846347459be8ea86b8dc62ced52a711941751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Tue, 3 Oct 2023 23:08:11 +0200 Subject: [PATCH] Change model default sort for Book --- .../migrations/0007_alter_book_options.py | 17 +++++++++++++++++ ram/bookshelf/models.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 ram/bookshelf/migrations/0007_alter_book_options.py diff --git a/ram/bookshelf/migrations/0007_alter_book_options.py b/ram/bookshelf/migrations/0007_alter_book_options.py new file mode 100644 index 0000000..bc5d827 --- /dev/null +++ b/ram/bookshelf/migrations/0007_alter_book_options.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.5 on 2023-10-03 21:07 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookshelf", "0006_alter_book_isbn"), + ] + + operations = [ + migrations.AlterModelOptions( + name="book", + options={"ordering": ["title"]}, + ), + ] diff --git a/ram/bookshelf/models.py b/ram/bookshelf/models.py index 276a3ea..112c68f 100644 --- a/ram/bookshelf/models.py +++ b/ram/bookshelf/models.py @@ -53,7 +53,7 @@ class Book(models.Model): updated_time = models.DateTimeField(auto_now=True) class Meta: - ordering = ["authors__last_name", "title"] + ordering = ["title"] def __str__(self): return self.title