Restore single if-statement of PR #369 change

fix_request_path_info
Diederik van der Boor 2019-07-11 22:10:42 +02:00
parent a1c779a295
commit 25f4dbb9cd
No known key found for this signature in database
GPG Key ID: 4FA014E0305E73C1
1 changed files with 7 additions and 7 deletions

View File

@ -107,13 +107,13 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
# Protect against bad imports (dumpdata without --natural) or other # Protect against bad imports (dumpdata without --natural) or other
# issues missing with the ContentType models. # issues missing with the ContentType models.
if model is not None and not issubclass(model, self.__class__): if model is not None \
if self.__class__._meta.proxy_for_model is None or \ and not issubclass(model, self.__class__) \
not issubclass(model, self.__class__._meta.proxy_for_model): and (self.__class__._meta.proxy_for_model is None \
or not issubclass(model, self.__class__._meta.proxy_for_model)):
raise PolymorphicTypeInvalid("ContentType {0} for {1} #{2} does not point to a subclass!".format( raise PolymorphicTypeInvalid("ContentType {0} for {1} #{2} does not point to a subclass!".format(
self.polymorphic_ctype_id, model, self.pk, self.polymorphic_ctype_id, model, self.pk,
)) ))
return model return model