I have a list of football matches for which I would like to display forms. The list comes from a remote source.
matches = ["A vs. B", "C vs. D", "E vs, F"] matchFormset = formset_factory(MatchForm,extra=len(matches)) formset = MatchFormset()
On the template side, I would like to display a set of forms with an appropriate heading (ie, “A vs. B”).
{% for form in formset.forms %} <fieldset> <legend>{{TITLE}}</legend> {{form.team1}} : {{form.team2}} </fieldset> {% endfor %}
Now how do I get a TITLE to contain the correct title for the current form? Or it is set differently: how do I matches over matches with the same index as iterating over formset.forms ?
Thanks for your input!
source share