Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.1.X] Fixed #11764 -- Added a missing set of parentheses in a call …

…calculating the select_related tables. Thanks to aurelio for the report and original patch, and wogan for the updated patch.

Backport of r13019 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13020 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 58c1a67ff1504d9368eb55461095f3a805b97ea7 1 parent c8576fa
Russell Keith-Magee freakboy3742 authored
4 django/db/models/sql/query.py
View
@@ -1380,8 +1380,8 @@ def fill_related_selections(self, opts=None, root_alias=None, cur_depth=1,
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,
7 tests/regressiontests/model_inheritance_regress/models.py
View
@@ -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 @@ def __unicode__(self):
>>> 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.
Please sign in to comment.
Something went wrong with that request. Please try again.