0

I am wondering how I can make custom error messages for the default user model in django 1.8. I am not trying to use model forms. I can find information on how to change the error messages on model forms, or on my own models, but on the actual User model, I don't understand. Thank you for your help.

EDIT: Just to be clear, I am not looking for error messages in django rest framework. I am trying to edit django's default User model error messages.

Mee
  • 139
  • 2
  • 9
  • In what context would you be using the error messages outside of a ModelForm though? – Daniel Roseman Jul 25 '15 at 20:57
  • I am using django rest framwork and angular for the front end. so in order to not have to do complicated things to make them all work together, i am just hard coding the form. – Mee Jul 25 '15 at 21:01
  • 1
    You will probably need to implement your own User model, as most error messages are set on the fields (https://github.com/django/django/blob/master/django/contrib/auth/models.py). What is it you are exactly trying to do? – Thom Wiggers Jul 25 '15 at 21:01
  • I am just trying to change the error messages at the database level of the User model. So for example: I submit an invalid email address, and it currently returns: "email: ["Enter a valid email address."]" but for me it would be much easier if it would return something different. Ill look at this git link now thanks. – Mee Jul 25 '15 at 21:09
  • If you're using DRF, you can set the validation messages on the Serializer. – Daniel Roseman Jul 25 '15 at 21:11
  • oh cool...do you know where or how? – Mee Jul 25 '15 at 21:14
  • possible duplicate of [Custom error messages in Django Rest Framework serializer](http://stackoverflow.com/questions/26943985/custom-error-messages-in-django-rest-framework-serializer) – Anton Strogonoff Jul 26 '15 at 02:35
  • This seems to be mainly about django-rest-framework’s handling of validation. – Anton Strogonoff Jul 26 '15 at 02:36
  • its not about django rest. I was very specific to ask about how to change user error messages on django models. – Mee Jul 26 '15 at 13:59

0 Answers0