From 58a9ee33481846aca907cae135291852e5e6392a Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 28 Jun 2017 16:13:07 +0200 Subject: [PATCH] default sort order for documents --- .../migrations/0017_auto_20170628_1612.py | 19 +++++++++++++++++++ apps/catalogue/models/document.py | 1 + 2 files changed, 20 insertions(+) create mode 100644 apps/catalogue/migrations/0017_auto_20170628_1612.py diff --git a/apps/catalogue/migrations/0017_auto_20170628_1612.py b/apps/catalogue/migrations/0017_auto_20170628_1612.py new file mode 100644 index 00000000..1e2dc73e --- /dev/null +++ b/apps/catalogue/migrations/0017_auto_20170628_1612.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-06-28 16:12 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0016_auto_20170425_1430'), + ] + + operations = [ + migrations.AlterModelOptions( + name='document', + options={'ordering': ['-revision__created_at'], 'verbose_name': 'document', 'verbose_name_plural': 'documents'}, + ), + ] diff --git a/apps/catalogue/models/document.py b/apps/catalogue/models/document.py index a1a0a3ce..9863e659 100755 --- a/apps/catalogue/models/document.py +++ b/apps/catalogue/models/document.py @@ -74,6 +74,7 @@ class Document(Ref): class Meta: verbose_name = _('document') verbose_name_plural = _('documents') + ordering = ['-revision__created_at'] def short_html(self): return render_to_string('catalogue/book_list/book.html', {'book': self}) -- 2.20.1