mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #20564 -- Generic relations exclude() regression
The patch for #19385 caused a regression in certain generic relations .exclude() filters if a subquery was needed. The fix contains a refactoring to how Query.split_exclude() and Query.trim_start() interact. Thanks to Trac alias nferrari for the report.
This commit is contained in:
parent
8c5b805ca1
commit
31fd64ad8a
3 changed files with 138 additions and 51 deletions
|
@ -131,3 +131,27 @@ class HasLinks(models.Model):
|
|||
|
||||
class HasLinkThing(HasLinks):
|
||||
pass
|
||||
|
||||
class A(models.Model):
|
||||
flag = models.NullBooleanField()
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
||||
|
||||
class B(models.Model):
|
||||
a = generic.GenericRelation(A)
|
||||
|
||||
class Meta:
|
||||
ordering = ('id',)
|
||||
|
||||
class C(models.Model):
|
||||
b = models.ForeignKey(B)
|
||||
|
||||
class Meta:
|
||||
ordering = ('id',)
|
||||
|
||||
class D(models.Model):
|
||||
b = models.ForeignKey(B, null=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ('id',)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue