diff options
| author | Tobias Kunze <r@rixx.de> | 2019-04-16 09:24:48 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-16 09:26:44 +0200 |
| commit | c0dc49a7722484484f588b91157a670889046859 (patch) | |
| tree | 28eee793fda6e73e6e5355137877a9a11a4d2589 /docs | |
| parent | 0ba78c39893338685b469c2884fbf26a4b9f857a (diff) | |
[2.2.x] Fixed #14009 -- Fixed custom formset validation example in docs.
Backport of d610521bffe9d44a070ebe3a719b474aff6d3d1e from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 0c4c7f0bee..fa1d7c76d8 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -274,7 +274,9 @@ is where you define your own validation that works at the formset level:: ... return ... titles = [] ... for form in self.forms: - ... title = form.cleaned_data['title'] + ... if self.can_delete and self._should_delete_form(form): + ... continue + ... title = form.cleaned_data.get('title') ... if title in titles: ... raise forms.ValidationError("Articles in a set must have distinct titles.") ... titles.append(title) |
