diff options
Diffstat (limited to 'tests/ordering/models.py')
| -rw-r--r-- | tests/ordering/models.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/ordering/models.py b/tests/ordering/models.py index 415b28bb41..2ab16f3c5f 100644 --- a/tests/ordering/models.py +++ b/tests/ordering/models.py @@ -17,25 +17,19 @@ from django.db import models from django.utils.encoding import python_2_unicode_compatible -@python_2_unicode_compatible -class Article(models.Model): - headline = models.CharField(max_length=100) - pub_date = models.DateTimeField() - +class Author(models.Model): class Meta: - ordering = ('-pub_date', 'headline') - - def __str__(self): - return self.headline + ordering = ('-pk',) @python_2_unicode_compatible -class ArticlePKOrdering(models.Model): +class Article(models.Model): + author = models.ForeignKey(Author, null=True) headline = models.CharField(max_length=100) pub_date = models.DateTimeField() class Meta: - ordering = ('-pk',) + ordering = ('-pub_date', 'headline') def __str__(self): return self.headline |
