On Thursday, August 18, 2016 at 1:34:29 PM UTC-5, Tim Graham wrote:
>
> 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.
>
> Ooooohhh, Tim! You might just have nailed it! Yes I am.

Here's the relevant code for the form field:
 
```
from_agent = forms.ModelChoiceField(
        required=False,
        queryset=EconomicAgent.objects.with_user(),
```

with_user() is a method of
class AgentManager(models.Manager)


 executed once and cached for as long as the server runs.
>

Is that behavior documented anywhere? Regardless, got any ideas how to 
avoid it?

But thank you very much for the likely suspect. 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/b55a8386-fffa-44ca-8543-f512cc4fbc6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to