On Thu, 2009-04-09 at 23:23 -0300, emonk wrote: > Hi, > I have this form: > class registerForm(forms.Form): > aNumber = forms.IntegerField( > label='Some Integer Field', > max_value=99999999, > > min_value=1000000, > help_text='7 digits min and 8 digits max', > error_messages={ > 'invalid':'Only numbers pls!', > > 'min_value':'min 7 digits!', > 'max_value':'max 8 digits!', >
If you have a look at the error messages you are replacing (in django/forms/fields.py), you'll see that they are passed a single parameter (indicated by the "%s"). So your replacement messages must be able to handle those parameters as well. If you look a bit closer, you'll see that the parameter being passed in is the maximum or minimum value. You're trying to use max- and min-values to talk about length, which isn't really the intention, so things aren't going to work nicely. If you want to talk about length, use a CharField, or a RegexField -- since you're trying to treat the input as a string (with a length), rather than a number (with a size). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---