I want to add remember me checkbox to my login view. I am using 'django.contrib.auth.views.login' view for login. I tried putting 'SESSION_COOKIE_AGE = 360' and a checkbox named "remember_me" after reading related questions. But, this didn't help. Seems like this feature isn't there in the default login view. Or am I missing something?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
由 翻译强力驱动
问题:
回答1:
Of course this is not in default login view. But you extend the default login form. Add this remember me feature in extended form, and then declare log in url like this:
url(r'^login/$', auth_views.login, {'template_name': 'your/login/template.html', 'form':YourExtendedForm}, name='auth_login'),
Also. There are many remember me snippets and projects out there. Do some googling and you will find working example in no time... like :https://github.com/jimfmunro/django-remember-me
Alan