Re: @method_decorator(login_required) but how to add "login_url=''login/" to login_required

306 views
Skip to first unread message

Sergiy Khohlov

unread,
May 25, 2013, 11:23:39 AM5/25/13
to django-users
you can set it in setting.py file

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Sat, May 25, 2013 at 9:33 AM, nany <happy...@gmail.com> wrote:
@method_decorator(login_required) but how to add "login_url=''/login/" to login_required

in function view, I use @login_required(login_url='login/') but in class based view, how? Anyone help?Thank you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

nany

unread,
May 26, 2013, 10:24:52 PM5/26/13
to django...@googlegroups.com
Thank your help,but could you tell me how to set in setting.py?
And I preffer to use the code style in funtional view ,like 
@login_required(login_url='abclogin/')
def get_list(request):
     pass
In class based view,I can't do like this?

在 2013年5月25日星期六UTC+8下午11时23分39秒,Sergiy Khohlov写道:

Kwaw Annor

unread,
May 29, 2014, 7:53:50 AM5/29/14
to django...@googlegroups.com
In your settings.py create this variables

LOGIN_URL = '/login_url/'

LOGIN_REDIRECT_URL = '/redirect_url/'

your can also try this
Reply all
Reply to author
Forward
0 new messages