mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Refs #25786 -- Added tests/release notes for set_FOO_order() crash with order_with_respect_to referencing OneToOneField pk.
Forwardport of6d9f061b07
from stable/1.8.x The issue was fixed by7bec480fe2
.
This commit is contained in:
parent
8091e8c5c6
commit
e07def14b8
3 changed files with 31 additions and 1 deletions
|
@ -42,3 +42,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, on_delete=models.CASCADE)
|
||||
|
||||
|
||||
class Component(models.Model):
|
||||
dimension = models.ForeignKey('Dimension', on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
order_with_respect_to = 'dimension'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue