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.

On Thursday, August 18, 2016 at 12:54:15 PM UTC-4, bobhaugen wrote:
>
> I'm running django 1.8.14, I have an odd problem, that I have reproduced 
> both locally using runserver and sqlite, and also using Apache with 
> Postgres.
>
> I create a new model instance on one page, and go to another page where 
> that same object should appear in a form selection list. It does not.
>
> After I restart the server (both with runserver and Apache) it appears.
>
> I also see other places where the same odd behavior with template 
> variables showing  foreign key relationships, like {{ 
> object.foreign_key_field }}.
>
> This is not on all pages, just some. It happens in both of the situations 
> I mentioned above (form selection choices and template variables for 
> foreign key fields).
>
> I grepped for cache. None in my code, a lot in site-packages, but I have 
> no idea where to look and what to look for.
>
> I would gratefully follow any clues.
>
> Thanks.
>

-- 
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/44c72a65-4082-408a-adf2-f1662e768563%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to