I'm having an issue trying to create pagination with a modelformset.
so far I have...
SubFormSet = modelformset_factory(Submission, can_delete=True,
extra=0, form=PricingForm)
...
objs = Submission.objects.all()
formset = SubFormSet(queryset=objs) <-overriding the basic
queryset
groups = map(None, objs, formset.forms) <- I need both the objects
and the forms, iterating over them together in the view
paginator = Paginator(groups, 10) <-- standard paginator
this_page =
paginator.page(ppage)
...then render
so, basically, this works for viewing, but submitting doesn't work
because the management form values (INITIAL_FORMS, FORM_COUNT, etc)
are wrong, they still hold the values of the whole queryset. I tried
feeding the formset constructor the object_list from the paginiator,
but that fails, complaining about "is_ordered" not being there.So my
considerations are to...
1.Change the management form values with js (scary at best)
2.Slice the queryset (seems like i'd have to duplicate all the
pagination in my code)
3.Try to overwrite the management_form values directly.
4.Set the max_num attribute of the model_formset
5.beg for help on the mailing list. :)
Anyone have any guidance as to which might be best option? Anyone ever
done this?
TIA