From 0e0ea28bb8f8ca5fbdb1cdf54a92f355ef99803e Mon Sep 17 00:00:00 2001 From: Simon Pither Date: Thu, 2 Mar 2017 09:53:19 +0000 Subject: [PATCH] NestedModelAdmi.all_valid_with_nesting was validating un-bound nested inlines, which failed without reporting any user visible errors. This happens when a nested inline has a further nested inline - the latter is not shown on the admin page initially and hence has no submitted values. Note that the re-rendered page (having failed to save but without error message) would then contain the deeper nested inline and re-submitting the page would then work. --- nested_inline/admin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nested_inline/admin.py b/nested_inline/admin.py index 51e75be..76640f6 100644 --- a/nested_inline/admin.py +++ b/nested_inline/admin.py @@ -126,12 +126,11 @@ def formset_has_nested_data(self, formsets): 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 + break + if not formset.is_valid(): + return False for form in formset: if hasattr(form, 'nested_formsets'): if not self.all_valid_with_nesting(form.nested_formsets):