Cache for everybody except staff members.
Posted
by Oli
on Stack Overflow
See other posts from Stack Overflow
or by Oli
Published on 2010-03-30T12:13:44Z
Indexed on
2010/03/30
13:03 UTC
Read the original article
Hit count: 358
django
|django-caching
I have a django site where I want to stick an "admin bar" along the top of every non-admin page for staff members. It would contain useful things like page editing tools, etc.
The problem comes from me using the @cache_page
decorator on lots of pages. If a normal user hits a page, the cached version comes up without the admin bar (even for admin users) and if an admin hits the page first, normal users see the admin bar.
I could tediously step through the templates, adding regional cache blocks but there are a lot of templates, and life is altogether too short.
Ideally, there would be a way of telling the caching to ignore cache get/set requests from admin users... But I don't know how to best implement that.
How would you tackle this problem?
© Stack Overflow or respective owner