Create a view function inside your app:
from django.contrib.auth import views as auth_views
...
def login_user(request, template_name='registration/login.html', extra_context=None):
response = auth_views.login(request, template_name)
if request.POST.has_key('remember_me'):
request.session.set_expiry(1209600) # 2 weeks
This view practically calls Django's original login view function, and then checks if the request contains a "remember_me" field checked. Also, in the settings file, you should make sure to set SESSION_EXPIRE_AT_BROWSER_CLOSE = True to make the default behavior such that the cookie expires when the user closes the browser.
You should now edit your login template to add the checkbox to the login form:
...
<input type="checkbox" name="remember_me" value="true">Remember Me</input>
...
Last, you should hook you application url to the new login view we just defined. Edit you applications urls.py:
urlpatterns = patterns('',
...
url(r'^login/$', login_user, {'template_name': 'registration/login.html'}, name='auth_login'),
Thanks!!!!!
ReplyDeleteThanks buddy... :D
ReplyDeleteGod bless you
ReplyDeleteThe market for mobile apps is growing rapidly and offers great opportunities for businesses. If you are considering making your own Android app there are several strategies and options to consider before getting started. You can learn how to develop Android apps and doing all the programming yourself. This is the hardest but also the most satisfying route. Other approaches are using an online "app maker" which generates the code for you or hiring freelancers or companies to do the development. Which ever way you choose is up to you: now is the time to join the mobile revolution! Source
ReplyDeleteI am glad to be a visitant of this gross web blog ! , regards for this rare info ! . Mega888 apk download
ReplyDeletei joined so many seo forum on the internet and they are really quite helpful and i have learned a lot, 안전놀이터
ReplyDeleteSecurity Cameras have proven to be an invaluable tool in catching criminals, and many felons who would otherwise be free are now behind bars. Those we hire to protect us and enforce the law are not always immune to the lure of criminal activity unfortunately, and security cameras record the truth without prejuduice and help us to weed out the rotten apples and punish them equally as they deserve. how do you make a spy camera out of household items
ReplyDeletehello!,I really like your writing very a lot! proportion we keep up a correspondence extra about your article on AOL? I require an expert in this house to resolve my problem. Maybe that is you! Having a look forward to see you. 188
ReplyDeleteYou can increase your blog visitors by having a fan page on facebook.*’.:* apaas
ReplyDeleteFound your weblog and decided to have a study on it, not what I usually do, but this blog is wonderful. Awesome to see a site that’s not spammed, and actually makes some sense. Anyway, great write up. buy steroids online
ReplyDeleteYou lost me, friend. What i’m saying is, I imagine I am what youre saying. I am aware what you’re saying, however, you just appear to have forgotten that might be another folks inside the world who view this issue for which it truly is and may even perhaps not go along with you. You may well be turning away many people that may have been lovers of your website. buy hgh
ReplyDeleteHeya i am for the first time here. I came across this board and I find It really useful & it helped me out a lot. I hope to give something back and help others like you helped me. clenbuterol for sale
ReplyDeletetoo much vitamin-a can also cause osteoporosis but aging is the number cause of it“ buy steroids online
ReplyDeleteHeya i am for the first time here. I came across this board and I find It really useful & it helped me out a lot. I hope to give something back and help others like you helped me. Play Therapy
ReplyDeletethe shoulder bags that my girlfriend uses are always made up from natural leather* iggy frome new amsterdam
ReplyDeleteAfter a short time, regular commenters begin to make a community. It starts to feel intrusive to insert yourself. ivrom streaming
ReplyDeleteWhether we like it or not mobile is fast becoming the preferred method of browsing the web and up to 50% of local searches are now performed on mobile devices. Indeed currently in the UK alone up to 8 million people access the internet every day using iPhones or smart phones. So with approximately every other user viewing the web (and possibly your web site) via mobile phones, have you stopped to consider whether your website is mobile ready? best mobile app developer ins ingapore
ReplyDelete