Merge pull request #77 from gnulnx/jf/polymorphic

Fix proposal for get_real_instance_class() for proxy models
fix_request_path_info
Diederik van der Boor 2014-04-29 11:56:15 +02:00
commit adf0be6579
1 changed files with 3 additions and 1 deletions

View File

@ -110,7 +110,9 @@ 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 \
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( raise RuntimeError("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,
)) ))