I'd guess you're doing a query for the form field's choices at the module level which will be executed once and cached for as long as the server runs. See if https://docs.djangoproject.com/en/stable/ref/forms/fields/#fields-which-handle-relationships helps, otherwise please post the code for the form in question.
executed once and cached for as long as the server runs.
queryset=None
when declaring the form field and then populate the queryset
in the form’s__init__()
method:"Hello,
This is trivial mistake. Use form.__init__ if you would like to change it dynamically
Also, how pervasive is this behavior? Does it affect all querysets generated by model methods? I do that all over the place. This could be bug heaven!
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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/16924d52-c9e7-4666-b80d-7baaa49e59e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,
This is trivial mistake. Use form.__init__ if you would like to change it dynamically
18 серп. 2016 22:14 "bobhaugen" <bob.h...@gmail.com> пише:
Also, how pervasive is this behavior? Does it affect all querysets generated by model methods? I do that all over the place. This could be bug heaven!--
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.
Could you show us the code of with_user? Maybe it does not return an
unevaluated queryset?
Honestly, I'm not sure what exactly you're asking here. Your
implementation of ``with_user`` was hard-wiring a queryset filter
based on the state of the database at the time ``with_user`` was
called. The rest is just standard Python behavior – since the method
was called during import (in the ModelForm definition), the result of
that call was used for the rest of the process' lifetime.