Use django's login and logout view

Use django's login and logout view, it will reduce the code written these two views