Fixed #27594 -- Fixed select_related() with reverse self-referential OneToOneField.

Fixed definition of `klass_info['from_parent']` so that two models aren't
considered from a parent class if the model classes are the same.
This commit is contained in:
Daniel Hillier 2016-12-14 01:06:54 +11:00 committed by Tim Graham
parent 2e9fa516fd
commit 7da37699e8
3 changed files with 20 additions and 3 deletions

View file

@ -102,3 +102,12 @@ class Child3(Child2):
class Child4(Child1):
value4 = models.IntegerField()
class LinkedList(models.Model):
name = models.CharField(max_length=50)
previous_item = models.OneToOneField(
'self', models.CASCADE,
related_name='next_item',
blank=True, null=True,
)