Fixed #14334 -- Query relation lookups now check object types.

Thanks rpbarlow for the suggestion; and loic, akaariai, and jorgecarleitao
for reviews.
This commit is contained in:
Anubhav Joshi 2014-06-14 12:54:19 +05:30 committed by Tim Graham
parent 81edf2d006
commit 34ba86706f
6 changed files with 144 additions and 21 deletions

View file

@ -409,6 +409,15 @@ class ObjectA(models.Model):
return self.name
class ProxyObjectA(ObjectA):
class Meta:
proxy = True
class ChildObjectA(ObjectA):
pass
@python_2_unicode_compatible
class ObjectB(models.Model):
name = models.CharField(max_length=50)
@ -419,11 +428,17 @@ class ObjectB(models.Model):
return self.name
class ProxyObjectB(ObjectB):
class Meta:
proxy = True
@python_2_unicode_compatible
class ObjectC(models.Model):
name = models.CharField(max_length=50)
objecta = models.ForeignKey(ObjectA, null=True)
objectb = models.ForeignKey(ObjectB, null=True)
childobjecta = models.ForeignKey(ChildObjectA, null=True, related_name='ca_pk')
def __str__(self):
return self.name