mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-17 03:25:19 +00:00
Adds ordering to status model
This commit is contained in:
parent
a67b0ae8a7
commit
1707bba8a8
2 changed files with 21 additions and 0 deletions
17
bookwyrm/migrations/0058_auto_20210324_1536.py
Normal file
17
bookwyrm/migrations/0058_auto_20210324_1536.py
Normal 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',)},
|
||||||
|
),
|
||||||
|
]
|
|
@ -58,6 +58,10 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||||
serialize_reverse_fields = [("attachments", "attachment", "id")]
|
serialize_reverse_fields = [("attachments", "attachment", "id")]
|
||||||
deserialize_reverse_fields = [("attachments", "attachment")]
|
deserialize_reverse_fields = [("attachments", "attachment")]
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
""" default sorting """
|
||||||
|
ordering = ("-published_date",)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
""" save and notify """
|
""" save and notify """
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue