From 157f6b10573060af0b8e35b904c56b92bc67ee74 Mon Sep 17 00:00:00 2001 From: Diederik van der Boor Date: Thu, 3 Apr 2014 14:10:53 +0200 Subject: [PATCH] Fix missing ``alters_data = True`` annotations. --- docs/changelog.rst | 1 + polymorphic/polymorphic_model.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e732e58..12e5d30 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 missing ``alters_data = True`` annotations on the overwritten ``save()`` methods. Version 0.5.3 (2013-09-17) diff --git a/polymorphic/polymorphic_model.py b/polymorphic/polymorphic_model.py index 5b20751..3f971c2 100644 --- a/polymorphic/polymorphic_model.py +++ b/polymorphic/polymorphic_model.py @@ -81,12 +81,14 @@ class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)): """ if not self.polymorphic_ctype_id: self.polymorphic_ctype = ContentType.objects.get_for_model(self, for_concrete_model=False) + pre_save_polymorphic.alters_data = True def save(self, *args, **kwargs): """Overridden model save function which supports the polymorphism functionality (through pre_save_polymorphic).""" self.pre_save_polymorphic() return super(PolymorphicModel, self).save(*args, **kwargs) + save.alters_data = True def get_real_instance_class(self): """