#NEWLINE# def homepage( request ) : #NEWLINE# #INDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = AuthenticationForm ( request = request , data = request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# user = form . get_user ( ) #NEWLINE# login ( request , user ) #NEWLINE# return redirect ( 'home' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = AuthenticationForm ( request = request ) #NEWLINE# #UNINDENT# request . session . set_test_cookie ( ) #NEWLINE# context = { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# #UNINDENT# } #NEWLINE# if request . user . is_authenticated ( ) : #NEWLINE# #INDENT# ( context [ 'days_log' ] , created ) = DaysLog . objects . get_or_create ( day = datetime . date . today ( ) ) #NEWLINE# #UNINDENT# return render ( created , 'home.html' , context )