Additional information with widgets in django

Posted by fromclouds on Stack Overflow See other posts from Stack Overflow or by fromclouds
Published on 2010-05-11T16:40:51Z Indexed on 2010/05/11 16:44 UTC
Read the original article Hit count: 199

Filed under:
|
|
|

I am displaying a django widget, with which I need to display additional information (something like a tool tip) that is attendant to the widget. I essentially have a widget that asks a random question, which is self contained.

{{ form.fieldname }}

displays the full widget which looks something like (à la the widget's render method):

<label for="id_answer">Question:</label>
<input type="hidden" name="question_id" value="n" />
<span class="prompt">What is the air-speed velocity of an unladen swallow?</span>
<input type="text" name="answer" />

What I'm essentially asking is, is there a way to break out the prompt, so that I can lay the widget out piecemeal? I would like to lay it out not with a call to {{ form.fieldname }} as above, but like:

{{ form.fieldname.label }}
{{ form.fieldname.prompt }}
{{ form.fieldname }}

Does anyone know how to do this?

© Stack Overflow or respective owner

Related posts about django

Related posts about widget