Ilian Iliev
Ilian Iliev

Reputation: 3236

Replace "this field is required" message in django admin

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

I already tried to add claen_field_1 method but it looks that it is not called when the field is empty. Any ideas will be appreciated

Upvotes: 6

Views: 3406

Answers (1)

KillianDS
KillianDS

Reputation: 17186

yes there is and actually this is forms functionality and not admin functionality ;), you can use this anywhere.

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

for more information see the django docs

Upvotes: 8

Related Questions