> Recall I'd like to make a table with each row in the table being a
> "form" for a paired Author-Book item (recall my book-author is 1-1).
> If I make an Author formset and a Books formset and then render them
> in the template it's not clear to me that the book part of the form
> would in fact correspond to the author part of the form. Actually... I
> expect I'd need to have nested for loops to loop over both formsets
> and that is not what I want...
> {% for AuthorForm in AuthorFormset.forms %}
> {% for BookForm in BookFormset.forms %}
> <tr><td><AuthorForm</td><td>BookForm</td></tr>
> {% endfor %}
> {% endfor %}
> will not give the desired result.Not nested loops no, but a loop that renders each AuthorForm and its twin BookForm. You'd probably want a template tag for that. > Regarding the one form idea... I'm new enough to django that it's not > clear to me how to "pre-populate" the formset in that case with the > data from the database. While I'm aware of the "initial" parameter in > the formset constructor it doesn't appear that was meant to initialize > a form with rows from a database. So it seems that I'd lose the > information that my initial data actually corresponds to items that > already exist in the database. That part is easy: just pass in a list of dictionaries that comprise the existing data, which you can get from a query. http://docs.djangoproject.com/en/1.2/topics/forms/formsets/#using-initial-data-with-a-formset Regards Scott -- 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.

