mirror of
https://github.com/django/django.git
synced 2025-10-09 18:12:39 +00:00
[1.8.x] Fixed #24174 -- Fixed extra order by descending
Backport of 69c6a6868f
from master
This commit is contained in:
parent
511ef69194
commit
0c910823c1
2 changed files with 24 additions and 2 deletions
|
@ -166,6 +166,26 @@ class OrderingTests(TestCase):
|
|||
attrgetter("headline")
|
||||
)
|
||||
|
||||
def test_extra_ordering_with_table_name(self):
|
||||
self.assertQuerysetEqual(
|
||||
Article.objects.extra(order_by=['ordering_article.headline']), [
|
||||
"Article 1",
|
||||
"Article 2",
|
||||
"Article 3",
|
||||
"Article 4",
|
||||
],
|
||||
attrgetter("headline")
|
||||
)
|
||||
self.assertQuerysetEqual(
|
||||
Article.objects.extra(order_by=['-ordering_article.headline']), [
|
||||
"Article 4",
|
||||
"Article 3",
|
||||
"Article 2",
|
||||
"Article 1",
|
||||
],
|
||||
attrgetter("headline")
|
||||
)
|
||||
|
||||
def test_order_by_pk(self):
|
||||
"""
|
||||
Ensure that 'pk' works as an ordering option in Meta.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue