Friday, April 27, 2012

Re: Cache for individualt request.user???

I realize this post is a bit old now. But I believe you could resolve
this issue by adding @vary_on_cookie like so:

@login_required
@vary_on_cookie
def webapp(request):
...

You'll want to test it, of course, but that should create a different
cache for each user (since session info is stored in a cookie).

_Nik

On 3/6/2012 2:53 AM, kase wrote:
> i don't know if the cache work for views with the content dependent
> from user...
>
> example.
>
> @login_required
> def webapp(request):
> grupos = Grupo.objects.filter(usuarios =
> request.user).order_by('grupo')
> return
> render_to_response('accounting/webapp.html',{'grupos':grupos},RequestContext(request))
>
> if i turn on the cache for view @cache_page(60*10)
>
> the user see your groups? or see the groups for the firts user to
> generete the cache? and if this case? what can i do?
> all my views dependent from request.user =S
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/OusOKXBfNoAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment