def all_valid_with_nesting(self, formsets): """Recursively validate all nested formsets """ if not all_valid(formsets): return False for formset in formsets: if not formset.is_bound: pass for form in formset: if hasattr(form, 'nested_formsets'): if not self.all_valid_with_nesting(form.nested_formsets): return False return True
def all_valid_with_nesting(self, formsets): """Recursively validate all nested formsets """ if not all_valid(formsets): return False for formset in formsets: if not formset.is_bound: pass for form in formset: if hasattr(form, 'nested_formsets'): if not self.all_valid_with_nesting(form.nested_formsets): return False return True
def all_valid_with_nesting(self, formsets): """Recursively validate all nested formsets """ if not all_valid(formsets): return False for formset in formsets: for form in formset: if hasattr(form, 'nested_formsets'): if not self.all_valid_with_nesting(form.nested_formsets): return False if not form.cleaned_data and any(f.cleaned_data for fs in form.nested_formsets for f in fs): form.add_error(None, 'Rodzic nie może być pusty') return False return True