On Wed, Sep 5, 2012 at 9:18 PM, mjh <martin.james.harri...@gmail.com> wrote: > yes it is being passed to the template as I can access the label, choices, > help_text, required items of the boundfield object... > > i.e., {{ issue.label }} {{ issue.choices }} {{ issue.help_text }} > > I can get everything it seems apart from the form object !!! > > {{ issue }} writes to the template: <django.forms.fields.ChoiceField object > at 0x40d03d0> > >
You want that fields forms.BoundField, not the forms.Field object you currently have. A BoundField is bound with the specific data in the form, especially if the form was submitted, and has things like error messages and a proper label field associated with them (you are outputting the raw label text currently). Change form.issues to be a list of the ids of the fields you require, rather than the forms.Field object and then use an attribute fetcher template tag in the template to retrieve the bound field from the form. Eg using this dict_get template tag: http://permalink.gmane.org/gmane.comp.python.django.user/106119 and storing the ids of the issues in form.issue_list {% for issue_id in form.issue_list %} {% with form|dict_get:issue_id as issue %} <div class="form-row"> {{ issue.errors }} {{ issue.label_tag }}: {{ issue }} </div> {% endwith %} {% endfor %} Hope that helps Tom -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.