mirror of
https://github.com/django/django.git
synced 2025-11-19 11:15:44 +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)
|
error = ValidationError(error)
|
||||||
|
|
||||||
if hasattr(error, "error_dict"):
|
if hasattr(error, "error_dict"):
|
||||||
if field is None:
|
if field is not 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:
|
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"The argument `field` must be `None` when the `error` "
|
"The argument `field` must be `None` when the `error` argument "
|
||||||
"argument contains errors for multiple fields."
|
"is a ValidationError with an error_dict."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
error = error.error_dict
|
error = error.error_dict
|
||||||
|
|
@ -316,7 +312,7 @@ class BaseForm(RenderableFormMixin):
|
||||||
field_id=self[field].auto_id,
|
field_id=self[field].auto_id,
|
||||||
)
|
)
|
||||||
self._errors[field].extend(error_list)
|
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]
|
del self.cleaned_data[field]
|
||||||
|
|
||||||
def has_error(self, field, code=None):
|
def has_error(self, field, code=None):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue