From 9a8822f68b07d27546ba23ab0490c37166bffce3 Mon Sep 17 00:00:00 2001 From: Jaap Joris Vens Date: Thu, 19 Mar 2020 18:59:29 +0100 Subject: [PATCH] This was one of those bugs where you search for hours, endlessly, only to arrive at a simple, senseful and elegant solution that costs only 3 lines to implement. I know I should be happy about that, but it really makes me feel like a total dumbass. --- cms/forms.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cms/forms.py b/cms/forms.py index f7955f2..389dd68 100644 --- a/cms/forms.py +++ b/cms/forms.py @@ -84,9 +84,14 @@ class SectionForm(forms.ModelForm): def is_valid(self): result = super().is_valid() - if self.is_bound: - for formset in self.formsets: - result = result and formset.is_valid() + for formset in self.formsets: + result = result and formset.is_valid() # AND + return result + + def has_changed(self): + result = super().has_changed() + for formset in self.formsets: + result = result or formset.has_changed() # OR return result def save(self, commit=True):