I have a form with several checkboxes created dynamically, where each 
field has a name similar to "mycheck_xxx". From within the template I 
don't know how many checks the form holds, since these are built 
dynamically. How can I render them using the Django template system?

For example, this is my Form (using newforms):

class FormList(forms.Form):
    def __init__(self, queues, *args, **kwargs):
        super(FormList, self).__init__(*args, **kwargs)
        # Create several check boxes
        for n in range(5):
            fieldname = 'mycheck_%d' % n
            self.fields[fieldname] = forms.BooleanField(required=False)

This is the template (one of several tries). Obviously, it doesn't work, 
but it reflects what I'd like to get on my form:

{% for fieldname in form.fields.keys %}
    <p>{{ form.fieldname }}</p>
{% endfor %}

Does any one know how I might accomplish this?

Thanks in advance for any help.

-- 
Mario Graziosi, mailto:[EMAIL PROTECTED]
FG&A srl (http://www.fgasoftware.com/)
[EMAIL PROTECTED]: The agile PBX (http://www.voiceatwork.eu/)
Tel: 02 9350-4780 interno 101, Fax: 02 9139-0172


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