mirror of https://github.com/django/django.git
Added a regression test for get() ordering clearing.
This commit is contained in:
parent
07577a2d05
commit
3b0cdb1410
|
@ -280,6 +280,14 @@ class Queries1Tests(BaseQuerysetTest):
|
|||
qs = qs.order_by('id')
|
||||
self.assertNotIn('OUTER JOIN', str(qs.query))
|
||||
|
||||
def test_get_clears_ordering(self):
|
||||
"""
|
||||
get() should clear ordering for optimization purposes.
|
||||
"""
|
||||
with CaptureQueriesContext(connection) as captured_queries:
|
||||
Author.objects.order_by('name').get(pk=self.a1.pk)
|
||||
self.assertNotIn('order by', captured_queries[0]['sql'].lower())
|
||||
|
||||
def test_tickets_4088_4306(self):
|
||||
self.assertQuerysetEqual(
|
||||
Report.objects.filter(creator=1001),
|
||||
|
|
Loading…
Reference in New Issue