1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

[1.8.x] Fixed #25786 -- Fixed set_FOO_order() crash with order_with_respect_to referencing OneToOneField pk.

Partial backport of 7bec480fe2 from master
This commit is contained in:
Tim Graham
2015-11-20 11:31:39 -05:00
parent 8f724817f3
commit 6d9f061b07
5 changed files with 47 additions and 4 deletions

View File

@@ -33,3 +33,19 @@ class Post(models.Model):
def __str__(self):
return self.title
# order_with_respect_to points to a model with a OneToOneField primary key.
class Entity(models.Model):
pass
class Dimension(models.Model):
entity = models.OneToOneField('Entity', primary_key=True)
class Component(models.Model):
dimension = models.ForeignKey('Dimension')
class Meta:
order_with_respect_to = 'dimension'