On 7/16/07, yml <[EMAIL PROTECTED]> wrote:
>
> This is not bat but i would prefer if instead of the list of tuple
> containing my forms could directly instantiate a "all in one" form.
> This would avoid the loop on list_answer_forms. This is were I get
> stuck. Could you please let me know how to add html text between the
> field?
> like "<h2>{{ poll.title }} | {{ poll.question }}</h2>"
If you want to do this, you will need to add a custom rendering scheme
to your form.
When you render a form using {{ form }}, you are effectively making a
call to form.as_table(). Django also provides an as_p and as_ul
variant to modify the way individual fields are rendered, which can be
accessed as {{ form.as_p }} or {{ form.as_ul }}.
To get per-field rendering like you describe, you will need to add a
custom as_ method. Look at the implementation of
django.newforms.Form.as_p() for an example implementation; adapting to
match your needs shouldn't be too hard.
Yours,
Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---