Hi all,
I'm running into a performance problem with some pages i created. The
page has multiple forms, which are all the same, with the exception of
the initial data (it's a kind of batch insert functionality), but all
foreign keys and such are identical (and as such lead to the same
querysets, that populate the select fields).
Now the problem is that the amount of queries skyrockets according to
the amount of forms that are being displayed (1 form -> 10 queries, 4
forms -> 40 queries, ...), because the same queries are being sent to
the database over and over, some of which are quite expensive
(yielding 600 results or more).

the view code looks like this:

mediaform = CustomMediaForm
forms = []
.....
and then in a for-loop:
form=mediaform(data, auto_id="some_generated_id")
forms.append(form)

The forms-array is then passed to the template:
{% for form in forms %}
...print form....
{% form %}

I guess the easiest way to avoid this behaviour would be somehow
overwrite the form.base_fields['somefield'].choices.queryset with a
cached queryset or something like that, but I couldn't get that to
work, without hitting the database every single time.

Any ideas?

cheers, sean


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to