On 12/1/07, machineghost <[EMAIL PROTECTED]> wrote:
>
>
> First off thanks in advance for any help you can provide. My problem
> is that I have a very long form with a very repetitive layout:
> <tr>
> <td class="label">{{ field.label }}</td>
> <td>{{ field }}</td>
> </tr>
> which should in theory be perfect for wrapping inside a {% for field
> in form %} {% endfor %} loop; right? Except there's one problem:
> every so often in this form there are divider rows that need to go in
> between the field rows.
>
> At first I thought I could just break the form fields in to lists, and
> then iterate through those lists separately, ie:
> (in view)
> firstSetOfFields = [form["field1"], form["field2"], ...]
> (in template)
> {% foreach field in firstSetOfFields %}
> but that didn't work at all, because firstSetOfFields was empty on the
> template (I guess it has something to do with the result of
> aForm["blah"] in a view not returning the same thing as aForm.blah on
> the template?).
I don't understand why this approach didn't work. I do essentially this in
a form I have. I'd try a little harder to understand what went wrong here
before moving onto your other approaches. (You did remember to pass in
'firstSetOfFields' as a variable in your template context, right?).
Karen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---