From 35cdb7b697f71e248fc4e06b7f734c4eaba01889 Mon Sep 17 00:00:00 2001 From: Diederik van der Boor Date: Mon, 7 Apr 2014 14:38:34 +0200 Subject: [PATCH] Fix subclass protection when ContentType is stale --- polymorphic/polymorphic_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polymorphic/polymorphic_model.py b/polymorphic/polymorphic_model.py index 76b4d51..daf2689 100644 --- a/polymorphic/polymorphic_model.py +++ b/polymorphic/polymorphic_model.py @@ -110,7 +110,7 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)): # Protect against bad imports (dumpdata without --natural) or other # issues missing with the ContentType models. - if not issubclass(model, self.__class__): + if model is not None and not issubclass(model, self.__class__): raise RuntimeError("ContentType {0} for {1} #{2} does not point to a subclass!".format( self.polymorphic_ctype_id, model, self.pk, ))