#12240: select_related doesn't work correctly when mixing nullable and
non-nullable
keys
------------------------------------------+---------------------------------
Reporter: embe | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
The following models:
{{{
class Model1(models.Model):
x = models.ForeignKey('Model2', null=True)
class Model2(models.Model):
y = models.ForeignKey('Model3', null=False)
class Model3(models.Model):
z = models.ForeignKey('Model4', null=False)
class Model4(models.Model):
q = models.IntegerField()
}}}
cause a problem with select_related():
{{{
In [4]: models.Model1.objects.select_related('x__y')
Out[4]: [<Model1: Model1 object>]
In [5]: models.Model1.objects.select_related('x__y__z')
Out[5]: []
}}}
It look like the fix for #7369 only fixed a case when a single non-
nullable ForeignKey is encountered, not when there are two in a row.
--
Ticket URL: <http://code.djangoproject.com/ticket/12240>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.