Replies: 6 comments
-
Hi, I guess you're building a Django site that mostly works without the user being logged in, but when a user is logged in (in this case, as it happens, via the admin) you're getting errors? I expect somewhere in your template you'll be accessing a property like |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response @j4mie I haven't accessed |
Beta Was this translation helpful? Give feedback.
-
Oh that's interesting. If I remember correctly, the debug toolbar injects itself into the response with a middleware rather than requiring an explicit template tag? That's a pain because it doesn't give you anywhere to "hook in" and wrap with From a quick glance I can't see an obvious way to resolve this. Possibly a subclass of the djdt middleware or maybe even monkeypatching the |
Beta Was this translation helpful? Give feedback.
-
Monkeypatching djdt is a bit above my paygrade, I'd say i'm only an advanced beginner python/django dev. A short term workaround I was trying to implement was to just not display the djdt toolbar when i'm logged in. However the act of just calling the settings.py
def show_toolbar(request):
return request.user.username == "me"
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': 'core.settings.base.show_toolbar',
} |
Beta Was this translation helpful? Give feedback.
-
Ah I think that makes sense - Out of interest, which approach to using |
Beta Was this translation helpful? Give feedback.
-
Ah that makes perfect sense now with Currently using Looked at the permissions gotcha you linked and tested Thanks again for helping get this working. |
Beta Was this translation helpful? Give feedback.
-
When i'm logged into django admin site any access of the rest of the site results in a QueriesDisabledError. Is there a work around for this instead of logging out the admin site?
Beta Was this translation helpful? Give feedback.
All reactions