On Thu, Aug 18, 2016 at 11:57:40AM -0700, bobhaugen wrote:
> 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)

Could you show us the code of with_user? Maybe it does not return an
unevaluated queryset?

Cheers,

Michal

-- 
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/20160819101915.GI27882%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Reply via email to