From f85ebdd9e6ed916149d8f3f739cbfd5d1bf34be5 Mon Sep 17 00:00:00 2001 From: John Furr Date: Mon, 28 Apr 2014 11:32:30 -0400 Subject: [PATCH] Fix get_real_instance_class for proxy models --- polymorphic/polymorphic_model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polymorphic/polymorphic_model.py b/polymorphic/polymorphic_model.py index 6e4c703..487f3b1 100644 --- a/polymorphic/polymorphic_model.py +++ b/polymorphic/polymorphic_model.py @@ -110,7 +110,9 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)): # Protect against bad imports (dumpdata without --natural) or other # issues missing with the ContentType models. - if model is not None and not issubclass(model, self.__class__): + if model is not None \ + and not issubclass(model, self.__class__) \ + and not issubclass(model, self.__class__._meta.proxy_for_model): raise RuntimeError("ContentType {0} for {1} #{2} does not point to a subclass!".format( self.polymorphic_ctype_id, model, self.pk, ))