From: Frédéric Perrin Date: Sat, 12 Nov 2016 15:02:33 +0000 (+0000) Subject: Add default ordering X-Git-Url: http://gitweb.fperrin.net/?p=djsite.git;a=commitdiff_plain;h=8e7c1ea13e2ab23eafb24ba2106b0dde9085f9b4 Add default ordering --- diff --git a/quotes/migrations/0004_auto_20161112_1454.py b/quotes/migrations/0004_auto_20161112_1454.py new file mode 100644 index 0000000..bee8401 --- /dev/null +++ b/quotes/migrations/0004_auto_20161112_1454.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-12 14:54 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('quotes', '0003_auto_20161101_0132'), + ] + + operations = [ + migrations.AlterModelOptions( + name='author', + options={'ordering': ['name']}, + ), + migrations.AlterModelOptions( + name='quote', + options={'ordering': ['pk']}, + ), + migrations.AlterModelOptions( + name='work', + options={'ordering': ['name']}, + ), + ] diff --git a/quotes/migrations/0005_auto_20161112_1502.py b/quotes/migrations/0005_auto_20161112_1502.py new file mode 100644 index 0000000..38edaa0 --- /dev/null +++ b/quotes/migrations/0005_auto_20161112_1502.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-12 15:02 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('quotes', '0004_auto_20161112_1454'), + ] + + operations = [ + migrations.AlterModelOptions( + name='quote', + options={'ordering': ['-pk']}, + ), + ] diff --git a/quotes/models.py b/quotes/models.py index 0d7fe33..34695df 100644 --- a/quotes/models.py +++ b/quotes/models.py @@ -52,6 +52,9 @@ class Author(CommonData): help_text="Date of death (leave blank \ if still alive!)") + class Meta(CommonData.Meta): + ordering = ['name'] + def __unicode__(self): return self.name @@ -94,6 +97,9 @@ class Work(CommonData): def get_absolute_url(self): return reverse('quotes:work', args=[str(self.id)]) + class Meta(CommonData.Meta): + ordering = ['name'] + class Quote(CommonData): text = HTMLField() tags = models.ManyToManyField(QuoteTag, blank=True) @@ -104,3 +110,7 @@ class Quote(CommonData): def get_absolute_url(self): return reverse('quotes:onequote', args=[str(self.id)]) + + class Meta(CommonData.Meta): + ordering = ['-pk'] +