We are new to the Django framework and are currently building an application in PythonAnywhere. We have a couple of html pages where the volume of formsets that we are loading up varies from 25 to 100. We find that when we use a small number of formsets, the page loads very quickly. However, performance seems to degrade as the numbers increase.
It's not an issue with our SQL queries as when we load the same data into a HTML table instead of using formsets, it loads very quickly.
We need to load the data using formsets because we expect updates to each row from the user.
Has anyone encountered this problem? If so, is there a way to improve the performance of the formsets or are formsets not intended to be used with large volumes of data? If not, are there alternative options that we can use that allow users to modify the data in multiple rows returned by the query? Note - we don't want to send the user to a 'Pop-Up' or another screen to update data. Note 2 - We are using "Model" formsets, in particular "inlineformset_factory".
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/48609393-cb83-4eea-845b-d353e41af1e7n%40googlegroups.com.
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20220225222926.GH11627%40fattuba.com.
If in fact I am….how do I avoid this? I have been playing with alternatives for a week and I’m starting to lose it…lol
Sent from Mail for Windows
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF-Y%3De5Fp7kDtLq47Z3Y4GEjXMne2PcTLYxOJ8St5gkKCkpUpw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CH0PR18MB42923C9432F56E071FA9716CD23F9%40CH0PR18MB4292.namprd18.prod.outlook.com.
However, caching the queryset solves only part of the problem.
If you have a formset with 100 forms, and each of these forms has
a choice field with 100 choices (say 50 bytes each), then you have
altogether 10k choices or 500k bytes of data. While, depending on
the particular case, this may be manageable, it can get quickly
out of hand if the forms become 200 or the choices become 200 or
more etc.
A technical solution to that problem could be to retrieve the choices only once and have some JavaScript fill in the choices in the forms. But this departs from the Django formset paradigm and might require significant development.
The alternative I see would be to redesign the UI so that it
doesn't need a formset (at least such a big formset). While I
don't know the specifics of this particular case, I would hack my
brains to see whether I can present this information in a more
simple manner to the user (because 100 forms would be overwhelming
I guess). Once I have a saner UI, the implementation details would
follow naturally.
Antonis Christofides +30-6979924665 (mobile)
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF-Y%3De4E3zFuzmK_UOf9exaEc5pM5FNun7xJXhn_yVbHyWqiWg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF-Y%3De5Fp7kDtLq47Z3Y4GEjXMne2PcTLYxOJ8St5gkKCkpUpw%40mail.gmail.com.