summaryrefslogtreecommitdiff
path: root/tests/managers_regress/models.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-01-22 01:43:49 -0500
committerSimon Charette <charette.s@gmail.com>2015-01-29 14:40:20 -0500
commiteb4cdfbdd64a95b303eaaa40a070521aa58362fd (patch)
tree424e70b5d869d223663f4c691b0e40a8035a26f2 /tests/managers_regress/models.py
parent55c76f4e3bab74c8544b72d11a99e94a1c2cfbce (diff)
Fixed #23940 -- Allowed model fields to be named `exact`.
An explicit `__exact` lookup in the related managers filters was interpreted as a reference to a foreign `exact` field. Thanks to Trac alias zhiyajun11 for the report, Josh for the investigation, Loïc for the test name and Tim for the review.
Diffstat (limited to 'tests/managers_regress/models.py')
-rw-r--r--tests/managers_regress/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/managers_regress/models.py b/tests/managers_regress/models.py
index c8869f1e26..99494448bd 100644
--- a/tests/managers_regress/models.py
+++ b/tests/managers_regress/models.py
@@ -129,6 +129,7 @@ class Child7(Parent):
@python_2_unicode_compatible
class RelatedModel(models.Model):
test_gfk = GenericRelation('RelationModel', content_type_field='gfk_ctype', object_id_field='gfk_id')
+ exact = models.NullBooleanField()
def __str__(self):
return force_text(self.pk)
@@ -140,8 +141,8 @@ class RelationModel(models.Model):
m2m = models.ManyToManyField(RelatedModel, related_name='test_m2m')
- gfk_ctype = models.ForeignKey(ContentType)
- gfk_id = models.IntegerField()
+ gfk_ctype = models.ForeignKey(ContentType, null=True)
+ gfk_id = models.IntegerField(null=True)
gfk = GenericForeignKey(ct_field='gfk_ctype', fk_field='gfk_id')
def __str__(self):