#NEWLINE# @ increment_visitor_counter #NEWLINE# def survey_end( request , survey_code , code ) : #NEWLINE# #INDENT# answer = get_object_or_404 ( SurveyAnswer . objects . select_related ( 'survey' ) , survey__is_active = True , survey__code = survey_code , code = code ) #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = SurveyEndForm ( request . POST , instance = answer , label_suffix = '' ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# form . save ( ) #NEWLINE# answer . update_status ( answer . COMPLETED ) #NEWLINE# return redirect ( 'survey_survey_thanks' , survey_code = survey_code , code = code ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = SurveyEndForm ( instance = answer , label_suffix = '' ) #NEWLINE# #UNINDENT# return render ( request , 'survey/end.html' , { #NEWLINE# #INDENT# 'survey' : answer . survey , #NEWLINE# 'answer' : answer , #NEWLINE# 'form' : form , #NEWLINE# #UNINDENT# } )