On Jul 16, 2006, at 7:51 PM, Todd O'Bryan wrote:

>
>
> 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'?

Uh, yeah. The problem with this is that you can't do {{ form.New  
Password }} in a template to render it.

So, why isn't there a display_name for FormFields?

Todd

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

Reply via email to