btw, thanks anyway :)

On Fri, Apr 10, 2009 at 12:07 AM, emonk <elmonke...@gmail.com> wrote:

> I do not understand that these messages are not working as if the other
> Who care if i talk about lenght, what happen if i talk about range of
> numbers?
> That should be work just like the message "invalid" .
>
>
> On Thu, Apr 9, 2009 at 11:50 PM, Malcolm Tredinnick <
> malc...@pointy-stick.com> wrote:
>
>>
>> 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
>>
>>
>> >>
>>
>
>
> --
> ---
> Key fingerprint = 0CCB D0F6 47F2 5F70 6F40  53D3 7537 A0E4 94FC 40EE
> ----------------------------------
>



-- 
---
Key fingerprint = 0CCB D0F6 47F2 5F70 6F40  53D3 7537 A0E4 94FC 40EE
----------------------------------

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to