Ticket #11764: 11764.patch

File 11764.patch, 1.8 KB (added by Greg Wogan-Browne, 14 years ago)

Updated patch against rev13018

  • django/db/models/sql/compiler.py

     
    546546                    lhs_col = int_opts.parents[int_model].column
    547547                    dedupe = lhs_col in opts.duplicate_targets
    548548                    if dedupe:
    549                         avoid.update(self.query.dupe_avoidance.get(id(opts), lhs_col),
    550                                 ())
     549                        avoid.update(self.query.dupe_avoidance.get((id(opts), lhs_col),
     550                                ()))
    551551                        dupe_set.add((opts, lhs_col))
    552552                    int_opts = int_model._meta
    553553                    alias = self.query.join((alias, int_opts.db_table, lhs_col,
  • tests/regressiontests/model_inheritance_regress/models.py

     
    5656class Supplier(models.Model):
    5757    restaurant = models.ForeignKey(Restaurant)
    5858
     59class Wholesaler(Supplier):
     60    retailer = models.ForeignKey(Supplier,related_name='wholesale_supplier')
     61
    5962class Parent(models.Model):
    6063    created = models.DateTimeField(default=datetime.datetime.now)
    6164
     
    268271>>> Supplier.objects.filter(restaurant=Restaurant(name='xx', address='yy'))
    269272[]
    270273
     274# Regression test for #11764.
     275>>> for w in Wholesaler.objects.all().select_related():
     276...     print w
     277
    271278# Regression test for #7853
    272279# If the parent class has a self-referential link, make sure that any updates
    273280# to that link via the child update the right table.
Back to Top