#NEWLINE# def get( self , request , app_label = None , actor = None , pk = None , fldname = None , tplname = None , **kw ) : #NEWLINE# #INDENT# if ( request . method == 'GET' ) : #NEWLINE# #INDENT# rpt = requested_actor ( app_label , actor ) #NEWLINE# elem = rpt . get_row_by_pk ( None , pk ) #NEWLINE# if ( elem is None ) : #NEWLINE# #INDENT# raise http . Http404 ( ( '%s %s does not exist.' % ( rpt , pk ) ) ) #NEWLINE# #UNINDENT# TextFieldTemplate = rt . modules . tinymce . TextFieldTemplate #NEWLINE# if tplname : #NEWLINE# #INDENT# tft = TextFieldTemplate . objects . get ( pk = int ( tplname ) ) #NEWLINE# if settings . SITE . trusted_templates : #NEWLINE# #INDENT# template = JinjaTemplate ( tft . text ) #NEWLINE# context = dict ( request = request , instance = elem , ** rt . modules ) #NEWLINE# return http . HttpResponse ( template . render ( ** context ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return http . HttpResponse ( tft . text ) #NEWLINE# #UNINDENT# #UNINDENT# qs = TextFieldTemplate . objects . all ( ) . order_by ( 'name' ) #NEWLINE# templates = [ ] #NEWLINE# for obj in qs : #NEWLINE# #INDENT# url = dd . plugins . tinymce . build_plain_url ( 'templates' , app_label , actor , pk , fldname , str ( obj . pk ) ) #NEWLINE# templates . append ( [ str ( obj . name ) , url , str ( obj . description ) ] ) #NEWLINE# #UNINDENT# js = ( 'var tinyMCETemplateList = %s;' % py2js ( templates ) ) #NEWLINE# return http . HttpResponse ( js , content_type = 'text/json' ) #NEWLINE# #UNINDENT# raise http . Http404 ( ( 'Method %r not supported' % request . method ) )