summaryrefslogtreecommitdiff
path: root/tests/ordering/models.py
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2022-02-03 20:24:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch)
treef0506b668a013d0063e5fba3dbf4863b466713ba /tests/ordering/models.py
parentf68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff)
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/ordering/models.py')
-rw-r--r--tests/ordering/models.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/ordering/models.py b/tests/ordering/models.py
index 95780c6a16..fce8b9cd42 100644
--- a/tests/ordering/models.py
+++ b/tests/ordering/models.py
@@ -18,37 +18,39 @@ from django.db import models
class Author(models.Model):
name = models.CharField(max_length=63, null=True, blank=True)
- editor = models.ForeignKey('self', models.CASCADE, null=True)
+ editor = models.ForeignKey("self", models.CASCADE, null=True)
class Meta:
- ordering = ('-pk',)
+ ordering = ("-pk",)
class Article(models.Model):
author = models.ForeignKey(Author, models.SET_NULL, null=True)
- second_author = models.ForeignKey(Author, models.SET_NULL, null=True, related_name='+')
+ second_author = models.ForeignKey(
+ Author, models.SET_NULL, null=True, related_name="+"
+ )
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
class Meta:
ordering = (
- '-pub_date',
- models.F('headline'),
- models.F('author__name').asc(),
- models.OrderBy(models.F('second_author__name')),
+ "-pub_date",
+ models.F("headline"),
+ models.F("author__name").asc(),
+ models.OrderBy(models.F("second_author__name")),
)
class OrderedByAuthorArticle(Article):
class Meta:
proxy = True
- ordering = ('author', 'second_author')
+ ordering = ("author", "second_author")
class OrderedByFArticle(Article):
class Meta:
proxy = True
- ordering = (models.F('author').asc(nulls_first=True), 'id')
+ ordering = (models.F("author").asc(nulls_first=True), "id")
class ChildArticle(Article):
@@ -59,4 +61,4 @@ class Reference(models.Model):
article = models.ForeignKey(OrderedByAuthorArticle, models.CASCADE)
class Meta:
- ordering = ('article',)
+ ordering = ("article",)