mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.9.x] Refs #25786 -- Added tests/release notes for set_FOO_order() crash with order_with_respect_to referencing OneToOneField pk.
Forwardport of6d9f061b07from stable/1.8.x The issue was fixed by7bec480fe2.
This commit is contained in:
		| @@ -6,7 +6,7 @@ from django.apps.registry import Apps | ||||
| from django.db import models | ||||
| from django.test import TestCase | ||||
|  | ||||
| from .models import Answer, Post, Question | ||||
| from .models import Answer, Dimension, Entity, Post, Question | ||||
|  | ||||
|  | ||||
| class OrderWithRespectToTests(TestCase): | ||||
| @@ -118,3 +118,13 @@ class OrderWithRespectToTests2(TestCase): | ||||
|                 count += 1 | ||||
|  | ||||
|         self.assertEqual(count, 1) | ||||
|  | ||||
|  | ||||
| class TestOrderWithRespectToOneToOnePK(TestCase): | ||||
|     def test_set_order(self): | ||||
|         e = Entity.objects.create() | ||||
|         d = Dimension.objects.create(entity=e) | ||||
|         c1 = d.component_set.create() | ||||
|         c2 = d.component_set.create() | ||||
|         d.set_component_order([c1.id, c2.id]) | ||||
|         self.assertQuerysetEqual(d.component_set.all(), [c1.id, c2.id], attrgetter('pk')) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user