newforms:

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

newforms:

Thomas Steinacher

Hello,

In newforms, there should be an easy way to render the radio fields
separately in the template, because I'd like to insert other form
fields between the radio inputs, e.g.:

[o] Use existing one: [________]
[ ] Add a new one: [________]

At the moment (using widget=forms.RadioSelect) all radio items are
rendered in a list and I can't insert anything between them.

I'd like to be able to do something like this:

<ul>
<li>{{ form.radio_options.1 }}: {{ form.foo }}</li>
<li>{{ form.radio_options.2 }}: {{ form.bar }}</li>
</ul>

What do you think?

Thomas Steinacher


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: newforms:

Adrian Holovaty-3

On 12/24/06, Thomas Steinacher <[hidden email]> wrote:
> In newforms, there should be an easy way to render the radio fields
> separately in the template, because I'd like to insert other form
> fields between the radio inputs, e.g.:
>
> [o] Use existing one: [________]
> [ ] Add a new one: [________]
>
> At the moment (using widget=forms.RadioSelect) all radio items are
> rendered in a list and I can't insert anything between them.

Hi Thomas,

In changeset [4238], I've implemented
RadioFieldRenderer.__getitem__(), which allows for index lookup on a
radio input. See the new unit tests in that changeset for examples:

    http://code.djangoproject.com/changeset/4238

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---