Ticket #11764: 11764.diff

File 11764.diff, 1.6 KB (added by Ramiro Morales, 14 years ago)

Same code patch plus regression test

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

    diff -r e7c74204f8f8 django/db/models/sql/query.py
    a b  
    13971397                    lhs_col = int_opts.parents[int_model].column
    13981398                    dedupe = lhs_col in opts.duplicate_targets
    13991399                    if dedupe:
    1400                         avoid.update(self.dupe_avoidance.get(id(opts), lhs_col),
    1401                                 ())
     1400                        avoid.update(self.dupe_avoidance.get((id(opts), lhs_col),
     1401                              ()))
    14021402                        dupe_set.add((opts, lhs_col))
    14031403                    int_opts = int_model._meta
    14041404                    alias = self.join((alias, int_opts.db_table, lhs_col,
  • tests/regressiontests/model_inheritance_regress/models.py

    diff -r e7c74204f8f8 tests/regressiontests/model_inheritance_regress/models.py
    a b  
    5555
    5656class Supplier(models.Model):
    5757    restaurant = models.ForeignKey(Restaurant)
     58
     59class WholesaleSupplier(Supplier):
     60    owned_retailer = models.ForeignKey(Supplier, related_name='partner_supplier')
    5861
    5962class Parent(models.Model):
    6063    created = models.DateTimeField(default=datetime.datetime.now)
     
    318321>>> ParkingLot3._meta.get_ancestor_link(Place).name  # the child->parent link
    319322"parent"
    320323
     324# Regression tests for #11764
     325
     326>>> qs = WholesaleSupplier.objects.all()
     327>>> qs = qs.select_related()
     328>>> for x in qs:
     329...     print x
     330
    321331"""}
    322332
Back to Top