Fix missing ``alters_data = True`` annotations.

fix_request_path_info
Diederik van der Boor 2014-04-03 14:10:53 +02:00
parent b73f22f4e0
commit 157f6b1057
2 changed files with 3 additions and 0 deletions

View File

@ -5,6 +5,7 @@ Version 0.5.4 (in development)
------------------------------ ------------------------------
* Fix ``.non_polymorphic()`` to returns a clone of the queryset, instead of effecting the existing queryset. * Fix ``.non_polymorphic()`` to returns a clone of the queryset, instead of effecting the existing queryset.
* Fix missing ``alters_data = True`` annotations on the overwritten ``save()`` methods.
Version 0.5.3 (2013-09-17) Version 0.5.3 (2013-09-17)

View File

@ -81,12 +81,14 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
""" """
if not self.polymorphic_ctype_id: if not self.polymorphic_ctype_id:
self.polymorphic_ctype = ContentType.objects.get_for_model(self, for_concrete_model=False) self.polymorphic_ctype = ContentType.objects.get_for_model(self, for_concrete_model=False)
pre_save_polymorphic.alters_data = True
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
"""Overridden model save function which supports the polymorphism """Overridden model save function which supports the polymorphism
functionality (through pre_save_polymorphic).""" functionality (through pre_save_polymorphic)."""
self.pre_save_polymorphic() self.pre_save_polymorphic()
return super(PolymorphicModel, self).save(*args, **kwargs) return super(PolymorphicModel, self).save(*args, **kwargs)
save.alters_data = True
def get_real_instance_class(self): def get_real_instance_class(self):
""" """