Skip to content

Commit

Permalink
Change model default sort for Book
Browse files Browse the repository at this point in the history
  • Loading branch information
daniviga committed Oct 3, 2023
1 parent 0822624 commit 2d48463
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions ram/bookshelf/migrations/0007_alter_book_options.py
Original file line number Diff line number Diff line change
@@ -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"]},
),
]
2 changes: 1 addition & 1 deletion ram/bookshelf/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d48463

Please sign in to comment.