On Mon, Nov 24, 2008 at 9:25 AM, Florencio Cano <[EMAIL PROTECTED]>wrote:
> I've done that because I want to change the default error_message and > I do not know who to do it :(. I've tried error_messages={} in the > field but it is now recognized in Fields in ModelForms only in plain > Forms. So, how can I change the default error_message if I'm using > ModelForms? > That error message is not currently customizable, there is a ticket open noting that: http://code.djangoproject.com/ticket/8913 It looks, though, like you are trying to customize the message to be Spanish -- at any rate the message you are using is very similar to the provided Spanish translation for that message. So I'm curious why you are not just using the Spanish translation? If you really absolutely need to customize the message in the absence of a fix for #8913 and without using a provided translation then the approach you have taken can work if you make your clean code query the database for uniqueness instead of trying to do it in Python. The reason you are seeing the built-in message is that your existing clean routine is not rejecting as duplicate a case that is caught by ModelForm's validate_unique. If you reject in your own clean routine everything that will be caught by the built-in ModelForm validate_unique then you won't see the built-in message. It's not ideal but it can be made to work. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---