<s> from django import template <EOL> from simpleadmindoc . util import model_attributes <EOL> register = template . Library ( ) <EOL> @ register . simple_tag <EOL> def rst_title ( title , level = "<STR_LIT:=>" ) : <EOL> content = [ unicode ( title ) , <EOL> level * len ( title ) ] <EOL> return "<STR_LIT:\n>" . join ( content ) <EOL> @ register . simple_tag <EOL> def rst_model_title ( app_label , object_name , level = "<STR_LIT:=>" ) : <EOL> """<STR_LIT>""" <EOL> title = "<STR_LIT>" % ( <EOL> app_label , <EOL> object_name <EOL> ) <EOL> return rst_title ( title , level ) <EOL> @ register . simple_tag <EOL> def render_model_attributes ( app_label , model_name ) : <EOL> lst = [ ] <EOL> for name , opts in model_attributes ( app_label , model_name ) . items ( ) : <EOL> lst . append ( "<STR_LIT>" % ( app_label , model_name , name ) ) <EOL> lst . append ( '<STR_LIT:U+0020>' ) <EOL> description = unicode ( opts [ '<STR_LIT:description>' ] ) <EOL> if description : <EOL> lst . append ( "<STR_LIT>" % description ) <EOL> lst . append ( '<STR_LIT:U+0020>' ) <EOL> return '<STR_LIT:\n>' . join ( lst ) </s>
