#NEWLINE# @ staff_member_required #NEWLINE# def template_detail( request , template ) : #NEWLINE# #INDENT# templates = [ ] #NEWLINE# for site_settings_module in settings . ADMIN_FOR : #NEWLINE# #INDENT# settings_mod = import_module ( site_settings_module ) #NEWLINE# if Site . _meta . installed : #NEWLINE# #INDENT# site_obj = Site . objects . get ( pk = settings_mod . SITE_ID ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# site_obj = GenericSite ( ) #NEWLINE# #UNINDENT# for dir in settings_mod . TEMPLATE_DIRS : #NEWLINE# #INDENT# template_file = os . path . join ( dir , settings_mod ) #NEWLINE# templates . append ( { #NEWLINE# #INDENT# 'file' : template_file , #NEWLINE# 'exists' : os . path . exists ( template_file ) , #NEWLINE# 'contents' : ( lambda : ( ( os . path . exists ( template_file ) and open ( template_file ) . read ( ) ) or '' ) ) , #NEWLINE# 'site_id' : settings_mod . SITE_ID , #NEWLINE# 'site' : site_obj , #NEWLINE# 'order' : list ( settings_mod . TEMPLATE_DIRS ) . index ( dir ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return render_to_response ( 'admin_doc/template_detail.html' , { #NEWLINE# #INDENT# 'root_path' : urlresolvers . reverse ( 'admin:index' ) , #NEWLINE# 'name' : template , #NEWLINE# 'templates' : templates , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )