#NEWLINE# def get_form( self , request , obj = None , **kwargs ) : #NEWLINE# #INDENT# form = super ( ChannelAdmin , self ) . get_form ( request , obj , ** kwargs ) #NEWLINE# channel_json = [ ] #NEWLINE# def _get_template_path( _path ) : #NEWLINE# #INDENT# template = get_template_path ( _path ) #NEWLINE# with open ( template ) as f : #NEWLINE# #INDENT# _jsonData = f . read ( ) . replace ( '\n' , '' ) #NEWLINE# return json . loads ( _jsonData ) #NEWLINE# #UNINDENT# #UNINDENT# def _get_json_channel( _obj ) : #NEWLINE# #INDENT# return _get_template_path ( 'containers/{0}/channel.json' . format ( _obj . long_slug ) ) #NEWLINE# #UNINDENT# def _get_json_channel_recursivelly( _obj ) : #NEWLINE# #INDENT# channel_json = [ ] #NEWLINE# try : #NEWLINE# #INDENT# channel_json = _get_json_channel ( _obj ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# _is_root = _obj . is_root_node ( ) #NEWLINE# if ( not _is_root ) : #NEWLINE# #INDENT# channel_json = _get_json_channel_recursivelly ( _obj . parent ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if _is_root : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# channel_json = _get_template_path ( 'containers/channel.json' ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# return channel_json #NEWLINE# #UNINDENT# #UNINDENT# channel_json = _get_json_channel_recursivelly ( obj ) #NEWLINE# if ( 'layout' in channel_json ) : #NEWLINE# #INDENT# layout_list = ( [ 'default' ] + [ l for l in channel_json [ 'layout' ] ] ) #NEWLINE# layout_choices = ( ( n , n . title ( ) ) for n in layout_list ) #NEWLINE# form . base_fields [ 'layout' ] . choices = layout_choices #NEWLINE# #UNINDENT# return _get_template_path