Each Form and FieldEntry instance has corresponding Field instances - those 
are where the labels are stored. Each Field instances has a Form ID, and 
each FieldEntry instance has a Field ID.

Your final code might end up pulling out all the Field instances in the 
view, passing them to the template (perhaps has a dict mapping Field IDs to 
labels), and a template tag that takes a FieldEntry instances, looks at its 
Field ID and returns the label.

Diving into models.py will describe all the above.



On Tuesday, 28 October 2014 04:16:41 UTC+11, Chris Meek wrote:
>
> I have an app that uses django-forms-builder. I have got it to display 
> the completed forms without the labels. How do I get it to match the labels 
> next to the fields within my template.
>
> urls.py
>
> url(r'^forms/get/(?P<form_entry_id>\d+)/$', 'gws.views.form', name='form'),
>
> views.py
>
>
> def form(request, form_entry_id=1):
>     entry = FormEntry.objects.get(id=form_entry_id)
>     field_entries = FieldEntry.objects.filter(entry=entry)
>     published = Form.objects.published()
>     return render_to_response('form/form.html', {'forms': 
>
> FormEntry.objects.get(id=form_entry_id), 'form': field_entries })
>
> form.html
>
> <table>
>     {% for f in form %}
>         <tr>
>             <td>{{f.value}}</td>
>         </tr>
>     {% endfor %}</table>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd987c39-b1f5-4382-b49f-e89ff6688c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to