1 2 3 4 5 | class MyForm(forms.Form):
def get_global_errors(self):
errors = dict(self.errors)
return list(errors.get("__all__", []))
|
More like this
- Complex Formsets, Redux by smagala 3 years, 2 months ago
- Model Forms: Clean unique field by johnboxall 4 years, 5 months ago
- Load initial form fields from GET parameters by ramen 3 years, 6 months ago
- load m2m fields objects by dirol 2 years, 11 months ago
- AjaxForm Base Classes by btaylordesign 2 years, 2 months ago
Comments
def get_global_errors(self): return self.errors and self.errors.get('_all_',[])
#
I am not sure about the situation at the time of writing this post, but global errors can be accessed by
{{ form.non_field_errors }}#