Replace the message "this field is required" in django admin

Is there a way to replace the default error message in django admin. I use a custom widget, so I have a form, and I was wondering if there is something like:
field_1 = forms.Charfield(widget=X, error_messge='y')

I already tried to add the claen_field_1 method, but it looks like it doesn't get called when the field is empty. Any ideas would be appreciated.

+7
django validation django-admin django-forms
source share
1 answer

yes there is and in fact this is the functionality of the forms, not the functionality of the administrator;), you can use it anywhere.

 field_1 = forms.Charfield(widget=X, error_messages={'required': 'y'}) 

for more information see django docs

+8
source share

All Articles