Adds ordering to status model

This commit is contained in:
Mouse Reeve 2021-03-24 08:37:25 -07:00
parent a67b0ae8a7
commit 1707bba8a8
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,17 @@
# Generated by Django 3.1.6 on 2021-03-24 15:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0057_user_discoverable'),
]
operations = [
migrations.AlterModelOptions(
name='status',
options={'ordering': ('-published_date',)},
),
]

View file

@ -58,6 +58,10 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
serialize_reverse_fields = [("attachments", "attachment", "id")]
deserialize_reverse_fields = [("attachments", "attachment")]
class Meta:
""" default sorting """
ordering = ("-published_date",)
def save(self, *args, **kwargs):
""" save and notify """
super().save(*args, **kwargs)