#NEWLINE# @ user_passes_test ( ( lambda user : user . is_superuser ) ) #NEWLINE# def static( request ) : #NEWLINE# #INDENT# User = get_user_model ( ) #NEWLINE# username_field = User . USERNAME_FIELD #NEWLINE# log = None #NEWLINE# username = request . GET . get ( 'username' ) #NEWLINE# if username : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# User . objects . get ( ** { #NEWLINE# #INDENT# username_field : username , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except User . DoesNotExist : #NEWLINE# #INDENT# messages . error ( request , _ ( 'User {} not found.' ) . format ( username ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log = get_log ( username ) #NEWLINE# if log : #NEWLINE# #INDENT# messages . info ( request , _ ( 'Logs found for {}.' ) . format ( username ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# messages . warning ( request , _ ( 'No logs for {}.' ) . format ( username ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return render ( request , 'userlog/static.html' , { #NEWLINE# #INDENT# 'title' : _ ( 'Static log' ) , #NEWLINE# 'log' : log , #NEWLINE# 'fieldname' : User . _meta . get_field ( username_field ) . verbose_name , #NEWLINE# #UNINDENT# } )