Any way to avoid the SQL hit of auth_messages?

4 views
Skip to first unread message

Rob Hudson

unread,
Oct 20, 2008, 2:13:20 PM10/20/08
to Django users
Hi,

I'm wanting to reduce an unneeded query from my page views in my
project caused from Django's built-in auth_messages. I'm looking for
the best solution to do this while still allowing me to use contrib/
auth and the admin.

The source of the query comes from the 'auth' context processor, I
believe. So one solution I've thought of would be not to use it. But
then the admin breaks horribly.

I'm curious of 2 workarounds:

1) Add the 'auth' context processor only for URLs starting with '/
admin/'?
2) Since I might want the user object hanging off of request at some
point, write my own auth context processor that doesn't add messages
or permissions stuff to request. I'm not sure exactly which parts of
the 'auth' context processor the admin uses so maybe this would need
to also do #1.

Or is there a better way to take care of this want (not necessarily a
"need").

Thanks,
Rob
Reply all
Reply to author
Forward
0 new messages