On Jul 16, 2006, at 7:38 PM, Malcolm Tredinnick wrote:
>
> On Sun, 2006-07-16 at 17:46 -0400, Todd O'Bryan wrote:
>> Is there any way to specify a user-friendly name for fields when
>> creating a Form object?
>>
>> I have a change password view, and right now I'm getting error
>> messages like
>>
>> This field must match the 'new_password' field.
>>
>> Obviously, I'd prefer something like the field's label, rather than
>> the field_name I've provided.
>
> The label is not specified at all at that level. It is something you
> just put in the template. So that matching is not going to happen
> automatically.
>
> Fortunately, you can pass in an error_message parameter to any
> validator. It sounds like you have a line somewhere that is like
>
>
> ..., validator_list = [AlwaysMatchesOtherField
> ('new_password')]
>
> Pass in your error message as the second parameter there.
>
> Regards,
> Malcolm
I guess what I want is the equivalent of display_name for Forms,
because I don't mind the default validator error messages except for
the field names.
Other than the fact that it doesn't look much like the name of
something in a program, is there anything wrong with doing
field_name='New Password'?
Todd
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---