mirror of
https://github.com/django/django.git
synced 2025-11-01 12:25:37 +00:00
Fixed #21376 -- New implementation for query join promotion logic
This commit introduced a new class JoinPromoter that can be used to abstract away join promotion problems for complex filter conditions. Query._add_q() and Query.combine() now use the new class. Also, added a lot of comments about why join promotion is done the way it is. Thanks to Tim Graham for original report and testing the changes, and for Loic Bistuer for review.
This commit is contained in:
parent
ae029b440a
commit
6fe2b001db
4 changed files with 161 additions and 137 deletions
|
|
@ -412,8 +412,8 @@ class ObjectB(models.Model):
|
|||
@python_2_unicode_compatible
|
||||
class ObjectC(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
objecta = models.ForeignKey(ObjectA)
|
||||
objectb = models.ForeignKey(ObjectB)
|
||||
objecta = models.ForeignKey(ObjectA, null=True)
|
||||
objectb = models.ForeignKey(ObjectB, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue