Mike H напиша:

> I am using the login_required decorator form
> django.contrib.auth.decorators, but I want to override the second
> argument which specified which url it should redirect to if the user is
> not logged in.
It's not messy to write your own. login_required only uses
user_passes_test to check if the user is authenticated.

See
http://www.djangoproject.com/documentation/authentication/#limiting-access-to-logged-in-users-that-pass-a-test
and the comments below.

Ex.

from django.contrib.auth.decorators import user_passes_test

login_required = user_passes_test(lambda u: u.is_authenticated(),
login_url='/redirect/url/')

And than use it.

@login_required
def someview(request):
...


-- 
Glisha
The perfect OS, MS-DOS!
No patches, no root exploits for 21 years.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to