mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.8.x] Refs #24060 -- Added a test demonstrating reverse order isn't mutable
Backport of f218a2ff45 from master
			
			
This commit is contained in:
		| @@ -137,6 +137,28 @@ class OrderingTests(TestCase): | ||||
|             attrgetter("headline") | ||||
|         ) | ||||
|  | ||||
|     def test_reverse_ordering_pure(self): | ||||
|         qs1 = Article.objects.order_by(F('headline').asc()) | ||||
|         qs2 = qs1.reverse() | ||||
|         self.assertQuerysetEqual( | ||||
|             qs1, [ | ||||
|                 "Article 1", | ||||
|                 "Article 2", | ||||
|                 "Article 3", | ||||
|                 "Article 4", | ||||
|             ], | ||||
|             attrgetter("headline") | ||||
|         ) | ||||
|         self.assertQuerysetEqual( | ||||
|             qs2, [ | ||||
|                 "Article 4", | ||||
|                 "Article 3", | ||||
|                 "Article 2", | ||||
|                 "Article 1", | ||||
|             ], | ||||
|             attrgetter("headline") | ||||
|         ) | ||||
|  | ||||
|     def test_extra_ordering(self): | ||||
|         """ | ||||
|         Ordering can be based on fields included from an 'extra' clause | ||||
|   | ||||
		Reference in New Issue
	
	Block a user