I need to display multiple forms (up to 10) of a model on a page. This is the code I use for to accomplish this.
TheFormSet = formset_factory(SomeForm, extra=10)
...
formset = TheFormSet(prefix='party')
return render_to_response('template.html', {
'formset' : formset,
})
The problem is, that it seems to me that Django queries the database for each of the forms in the formset, even though the data displayed in them is the same.
Is this the way Formsets work or am I doing something wrong? Is there a way around it inside django or would I have to use JavaScript for a workaround?
What happens if you use modelformset_factory
instead of formset_factory
? Does that help?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With