1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #25622 -- Accounted for generic relations in the admin to field validation

Thanks to Jonathan Liuti for the report and Tim Graham for the review.
This commit is contained in:
Simon Charette
2015-10-28 11:25:25 -04:00
parent 96fe90f535
commit 9dcfecb7c6
5 changed files with 40 additions and 13 deletions

View File

@@ -938,3 +938,14 @@ class ExplicitlyProvidedPK(models.Model):
class ImplicitlyGeneratedPK(models.Model):
name = models.IntegerField(unique=True)
# Models for #25622
class ReferencedByGenRel(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
class GenRelReference(models.Model):
references = GenericRelation(ReferencedByGenRel)