mirror of https://github.com/django/django.git
Fixed #14009 -- Fixed custom formset validation example in docs.
This commit is contained in:
parent
516d858e7a
commit
d610521bff
|
@ -274,7 +274,9 @@ is where you define your own validation that works at the formset level::
|
||||||
... return
|
... return
|
||||||
... titles = []
|
... titles = []
|
||||||
... for form in self.forms:
|
... 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:
|
... if title in titles:
|
||||||
... raise forms.ValidationError("Articles in a set must have distinct titles.")
|
... raise forms.ValidationError("Articles in a set must have distinct titles.")
|
||||||
... titles.append(title)
|
... titles.append(title)
|
||||||
|
|
Loading…
Reference in New Issue