Fix books default ordering

This commit is contained in:
2023-10-03 21:58:45 +02:00
parent cbd76e4f66
commit 12ac33f4a2
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# Generated by Django 4.2.5 on 2023-10-03 19:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("bookshelf", "0004_rename_numbers_of_pages_book_number_of_pages"),
]
operations = [
migrations.AlterModelOptions(
name="book",
options={
"ordering": ["authors__last_name", "title"],
"verbose_name_plural": "Rolling stock",
},
),
]

View File

@@ -52,6 +52,10 @@ class Book(models.Model):
creation_time = models.DateTimeField(auto_now_add=True) creation_time = models.DateTimeField(auto_now_add=True)
updated_time = models.DateTimeField(auto_now=True) updated_time = models.DateTimeField(auto_now=True)
class Meta:
ordering = ["authors__last_name", "title"]
verbose_name_plural = "Rolling stock"
def __str__(self): def __str__(self):
return self.title return self.title