django form customization

2 views
Skip to first unread message

Billy Huang

unread,
Sep 18, 2011, 7:51:22 PM9/18/11
to code-p...@googlegroups.com
Hey everyone I'm looking at the customising the form template in https://docs.djangoproject.com/en/dev/topics/forms/

does anyone know where is this file? or where should i create it.

Matthew Fernandez

unread,
Sep 18, 2011, 7:48:31 PM9/18/11
to code-p...@googlegroups.com
Is this for a particular project or are you just asking about Django in general?

Billy Huang

unread,
Sep 18, 2011, 8:09:26 PM9/18/11
to code-p...@googlegroups.com
in general

Matthew Fernandez

unread,
Sep 18, 2011, 7:55:27 PM9/18/11
to code-p...@googlegroups.com
Ah, in that case I can't help. Anyone else know Django well?

Billy Huang

unread,
Sep 18, 2011, 8:20:49 PM9/18/11
to code-p...@googlegroups.com
thx matt, probably make it more specific

i got this {{form.as_p}}, but i need more control at the dom. I'm trying to add these template tags into this file see if it works.

Patrick Coleman

unread,
Sep 18, 2011, 9:15:46 PM9/18/11
to code-p...@googlegroups.com
Is the "Customizing the form template" section what you're after?
i.e. {% for field in form %} to iterate over the properties in the form, or {{ form.name_of_field }} to display the HTML for a single field property.
If you need per-field customisation of HTML though, I'm not familiar with how to do that; each field is a BoundField. BoundField object though 
so that might have a way to override form input widgets for each type.

- Pat
Reply all
Reply to author
Forward
0 new messages