Monday, 15 February 2010

Redirect to the login URL when user enters default address in Django? -



Redirect to the login URL when user enters default address in Django? -

i have url takes user login page:

url(r'^login_backend', 'fileupload.backend.login_backend'),

since user doesn't want remember:

http://127.0.0.1:8000/login_backend

i want redirect http://127.0.0.1:8000 http://127.0.0.1:8000/login_backend without affecting other activity. have decorator above every view:

@login_required(login_url='/login_backend/')

you can utilize django generic redirect_to view. add together next in urls.py

urlpatterns = patterns('django.views.generic.simple', ('^$', 'redirect_to', {'url': 'login_backend/'}), )

django

No comments:

Post a Comment