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?). Next I thought I could use an {%ifequal field form.field1 %} to identify when I was on a field which had a divider row before it. However, since those two aren't technically equal, they never matched, and my divider rows never got displayed. I then tried the same thing using the "field.label" and "form.field1.label" ... and that actually worked. Unfortunately however, two of the fields in my form have the same label, and both of them are supposed to have (different) divider rows before their row, so that method ultimately failed also. I know I could just manually lay out every field on my template, but this is a really long form and it kills me to have lots of hard-coded repetitive HTML when I know there's got to be some way to follow the DRY principle and reduce it all to a for loop. Can anyone help me figure out how to do so? Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---