On 31 Jul 2009, at 17:04 , When ideas fail wrote:
>
> Hello, if i am using this generic view in my urls.py?
>
> (r'^accounts/login/$', 'django.contrib.auth.views.login',
> {'template_name': 'myapp/login.html'}),
>
> Is there a way i can stopped people who are already logged in logging
> in again?
How about simply providing different content if the user is already
logged in (in your template)?
Alternatively, you can create your own decorator (I'd have suggested
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.decorators.user_passes_test
but it redirects to the login page so that's not an option): you
merely need to check if request.user.is_authenticated().
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---