On 23 maj, 21:28, Mike Ramirez <gufym...@gmail.com> wrote: > On Saturday 23 May 2009 11:53:08 am Rok wrote: > > > I am using @login_required decorator, where "I" do not have to write > > my login view, since decorator does everything "I" want. When user is > > not logged in it gets redirected to LOGIN_URL where he can login, when > > he request URL/view which has @login_required decorator... > > > But what if user requests LOGIN_URL by writing it directly to the > > browser URL field? User gets login form regardless if he is logged in > > or not. > > Have you tried using request.user.is_authenticated in the template? > > {% if request.user.is_authenticated %} > > You are already logged in. If you're having problems, please clear all your > cookies and login again. Thanks. > > {% else } > > Login form > > {% endif %} > > for request.user to be available, make sure you have > django.core.context_processors.auth in your TEMPLATE_CONTEXT_PROCESSORS. > > Mike > > -- > purpitation, n.: > To take something off the grocery shelf, decide you > don't want it, and then put it in another section. > -- "Sniglets", Rich Hall & Friends > > signature.asc > < 1 KOgledPrenos
Tried, but still no luck. Is it enough just to set TEMPLATE_CONTEXT_PROCESSORS or should I add something else? --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---