Thank you for information:)

2013/2/16 Christophe Pettus <[email protected]>:
>
> On Feb 16, 2013, at 9:16 AM, Christophe Pettus wrote:
>
>>
>> On Feb 16, 2013, at 8:50 AM, ozgur yilmaz wrote:
>>
>>> I'm using template fragment caching in my project. I'm wondering what
>>> the view function do when template fragment caching is active? Are
>>> queries in the view function be executed? Or bypass the queries and
>>> read the cached fragment?
>>
>> The view function is not bypassed when template fragment caching is active.  
>> Thus, if you do a bunch of expense queries to populate the context, those 
>> queries will still happen; the only step that is skipped is the actual 
>> rendering of the template.  It's often a good idea to have those expense 
>> queries be done on-demand in a callable that is invoked by the template, so 
>> they are only called when the template is actually rendered.
>
> Of course, QuerySets are (usually) lazy, so if you pass them in to the 
> template via the context unevaluated, and that fragment of the template is 
> cached, the query won't be executed.
>
> --
> -- Christophe Pettus
>    [email protected]
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to