Skip to content

Commit

Permalink
Fix flaky test for GFK
Browse files Browse the repository at this point in the history
  • Loading branch information
amureki committed Aug 26, 2024
1 parent f9f441c commit c984eea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/generic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ class UnsupportedModel(models.Model):

class DummyGenericForeignKeyModel(models.Model):
content_type = models.ForeignKey(
contenttypes.ContentType, on_delete=models.CASCADE
contenttypes.ContentType,
on_delete=models.CASCADE,
limit_choices_to={"model__in": ["person", "dog"]},
)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey("content_type", "object_id")
Expand All @@ -297,7 +299,11 @@ class DummyGenericRelationModel(models.Model):

class GenericForeignKeyModelWithOptionalData(models.Model):
content_type = models.ForeignKey(
contenttypes.ContentType, on_delete=models.CASCADE, blank=True, null=True
contenttypes.ContentType,
on_delete=models.CASCADE,
blank=True,
null=True,
limit_choices_to={"model__in": ["person", "dog"]},
)
object_id = models.PositiveIntegerField(blank=True, null=True)
content_object = GenericForeignKey("content_type", "object_id")
Expand Down

0 comments on commit c984eea

Please sign in to comment.