mirror of
https://github.com/django/django.git
synced 2025-11-18 19:01:40 +00:00
removing forms change only updating the messaging
This commit is contained in:
parent
f73b3fbb0c
commit
774a101280
1 changed files with 4 additions and 8 deletions
|
|
@ -285,14 +285,10 @@ class BaseForm(RenderableFormMixin):
|
|||
error = ValidationError(error)
|
||||
|
||||
if hasattr(error, "error_dict"):
|
||||
if field is None:
|
||||
error = error.error_dict
|
||||
# Raise an error if the ValidationError contains more than one
|
||||
# item or if the only item's key doesn't match the form field.
|
||||
elif len(error.error_dict) != 1 or field not in error.error_dict:
|
||||
if field is not None:
|
||||
raise TypeError(
|
||||
"The argument `field` must be `None` when the `error` "
|
||||
"argument contains errors for multiple fields."
|
||||
"The argument `field` must be `None` when the `error` argument "
|
||||
"is a ValidationError with an error_dict."
|
||||
)
|
||||
else:
|
||||
error = error.error_dict
|
||||
|
|
@ -316,7 +312,7 @@ class BaseForm(RenderableFormMixin):
|
|||
field_id=self[field].auto_id,
|
||||
)
|
||||
self._errors[field].extend(error_list)
|
||||
if hasattr(self, "cleaned_data") and field in self.cleaned_data:
|
||||
if field in self.cleaned_data:
|
||||
del self.cleaned_data[field]
|
||||
|
||||
def has_error(self, field, code=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue