summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/sql/query.py4
-rw-r--r--tests/regressiontests/model_inheritance_regress/models.py7
2 files changed, 9 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 131e97a438..4c473b6b7e 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1380,8 +1380,8 @@ class BaseQuery(object):
lhs_col = int_opts.parents[int_model].column
dedupe = lhs_col in opts.duplicate_targets
if dedupe:
- avoid.update(self.dupe_avoidance.get(id(opts), lhs_col),
- ())
+ avoid.update(self.dupe_avoidance.get((id(opts), lhs_col),
+ ()))
dupe_set.add((opts, lhs_col))
int_opts = int_model._meta
alias = self.join((alias, int_opts.db_table, lhs_col,
diff --git a/tests/regressiontests/model_inheritance_regress/models.py b/tests/regressiontests/model_inheritance_regress/models.py
index a1ee6a2d86..f31fc3d926 100644
--- a/tests/regressiontests/model_inheritance_regress/models.py
+++ b/tests/regressiontests/model_inheritance_regress/models.py
@@ -56,6 +56,9 @@ class ParkingLot3(Place):
class Supplier(models.Model):
restaurant = models.ForeignKey(Restaurant)
+class Wholesaler(Supplier):
+ retailer = models.ForeignKey(Supplier,related_name='wholesale_supplier')
+
class Parent(models.Model):
created = models.DateTimeField(default=datetime.datetime.now)
@@ -238,6 +241,10 @@ True
>>> Supplier.objects.filter(restaurant=Restaurant(name='xx', address='yy'))
[]
+# Regression test for #11764.
+>>> for w in Wholesaler.objects.all().select_related():
+... print w
+
# Regression test for #7853
# If the parent class has a self-referential link, make sure that any updates
# to that link via the child update the right table.