Hi,
I'm working with pagination of a large formset in my view function. For
forms outside the range to be viewed, I'm currently doing this:
for form in results_formset:
place_to_test = int(form['placing'].value())
if place_to_test not in visible_range:
form.fields['race_number'].widget = HiddenInput()
visible_range is a list of places that should be viewed according to the
pagination.
However, most of the formset is hidden. Simply using a HiddenInput()
results in a large number of non-visible forms still being sent from the
server. I have a scheme where I will condense the hidden information from
the non-visible forms to save bandwidth. To do this within the current code
structure requires me to be able to remove a non-visible form from the
formset.
My code should become something like:
for form in results_formset:
place_to_test = int(form['placing'].value())
race_number = form['race_number'].value()
if place_to_test not in visible_range:
# need method to remove form from results_formset
pass
# condensing the information to save bandwidth
if place_to_test < range_min:
hidden_before.append("%s:%s" % (place_to_test, race_number))
elif place_to_test > range_max:
hidden_after.append("%s:%s" % (place_to_test, race_number))
I can't find how to remove the non-visible form from the formset - can
anyone provide a pointer?
Best wishes,
Richard Brockie
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/a420ec56-079f-46c0-a5f0-843e33d56b3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.