kopia lustrzana https://github.com/rtts/django-simplecms
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.main
rodzic
764f135785
commit
9a8822f68b
11
cms/forms.py
11
cms/forms.py
|
@ -84,9 +84,14 @@ class SectionForm(forms.ModelForm):
|
||||||
|
|
||||||
def is_valid(self):
|
def is_valid(self):
|
||||||
result = super().is_valid()
|
result = super().is_valid()
|
||||||
if self.is_bound:
|
for formset in self.formsets:
|
||||||
for formset in self.formsets:
|
result = result and formset.is_valid() # AND
|
||||||
result = result and formset.is_valid()
|
return result
|
||||||
|
|
||||||
|
def has_changed(self):
|
||||||
|
result = super().has_changed()
|
||||||
|
for formset in self.formsets:
|
||||||
|
result = result or formset.has_changed() # OR
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
|
Ładowanie…
Reference in New Issue