@register.filter(name='str_to_dic')
def str_to_dic(info):
 if ('{' in info):
  info_dic = ast.literal_eval(info).iteritems()
 else:
  info_dic = {}
 return info_dic

@ register . filter ( name = 'str_to_dic' ) def str_to_dic ( info ) : if ( '{' in info ) : info_dic = ast . literal_eval ( info ) . iteritems ( ) else : info_dic = { } return info_dic
str to list .