playfire / django-debug-toolbar-user-panel

Panel for the Django Debug toolbar to quickly switch between users
http://code.playfire.com/django-debug-toolbar-user-panel/
BSD 3-Clause "New" or "Revised" License
81 stars 31 forks source link

Current User shows "Not logged in" all the time #15

Closed paramburu closed 11 years ago

paramburu commented 11 years ago

request.user can be accessed from views not from templates (according to the documentation).

https://docs.djangoproject.com/en/1.4/topics/auth/#authentication-in-web-requests

From templates it's the context variable user, from: https://docs.djangoproject.com/en/1.4/topics/auth/#id8

At least since 1.0 (in the docs) can be accessed this way.

This, according to the docs, may stay the same in 1.5 but, on the view layer may need to change a little.

lamby commented 11 years ago

This, according to the docs, may stay the same in 1.5 but, on the view layer may need to change a little.

Don't understand this.

What is your TEMPLATE_CONTEXT_PROCESSORS? You are probably missing django.core.context_processors.request.

paramburu commented 11 years ago

Actually, yes. I don't have it because I mainly don't need it (and it's not "on" by default on 1.4). Maybe, if the user context is automatically "on" with the auth context processor (needed by the auth module), the template should rely on that context instead of the request?

Just an opinion, because it didn't work for me and didn't realized I needed the request context processor.

lamby commented 11 years ago

Agreed.