Skip to content

Commit

Permalink
[2.2.x] Fixed #14009 -- Fixed custom formset validation example in docs.
Browse files Browse the repository at this point in the history
Backport of d610521 from master
  • Loading branch information
rixx authored and felixxm committed Apr 16, 2019
1 parent 0ba78c3 commit c0dc49a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/topics/forms/formsets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c0dc49a

Please sign in to comment.