From 6eaf43a24471f98939da18d031b4f0b4e49640c6 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Wed, 28 Oct 2015 11:25:25 -0400 Subject: [1.9.x] 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. Backport of 9dcfecb7c6c8285630ad271888a9ec4ba9140e3a from master --- tests/admin_views/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/admin_views/models.py') diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 1199da3973..3ecaf57b6d 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -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) -- cgit v1.3