On Sat, 2008-02-23 at 21:21 -0800, Zack wrote:
[...]
> Why doesn't
> >>> f = TestPersonForm()
> >>> f.as_p()
> have labels generated for all the CharFields as defined in
> PersonField?

Because that's not how MultiWidget works.

You can see from the code that the labels on widgets are created by the
Form._html_output() method, not by the widget rendering methods (which
makes sense, as often the label side of things is changed). You can also
see that MultiWidget's rendering method just calls the rendering method
on each of its sub-widgets.

If you want your sub-fields to render with labels and everything, make
them separate fields and then use the form's clean() method to combine
their individual values back into a single value (since Form.clean() is
designed for normalising values that come from multiple fields).

Regards,
Malcolm

-- 
Tolkien is hobbit-forming. 
http://www.pointy-stick.com/blog/


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

Reply via email to