本文整理匯總了Python中xadmin.util.model_format_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python util.model_format_dict方法的具體用法?Python util.model_format_dict怎麽用?Python util.model_format_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xadmin.util
的用法示例。
在下文中一共展示了util.model_format_dict方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_action_choices
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import model_format_dict [as 別名]
def get_action_choices(self):
"""
Return a list of choices for use in a form object. Each choice is a
tuple (name, description).
"""
choices = []
for ac, name, description, icon in self.actions.values():
choice = (name, description % model_format_dict(self.opts), icon)
choices.append(choice)
return choices
示例2: get_action_choices
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import model_format_dict [as 別名]
def get_action_choices(self):
"""
Return a list of choices for use in a form object. Each choice is a
tuple (name, description).
"""
choices = []
for ac, name, description, icon in self.actions.itervalues():
choice = (name, description % model_format_dict(self.opts), icon)
choices.append(choice)
return choices
示例3: do_action_func
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import model_format_dict [as 別名]
def do_action_func(self, __):
def _method():
self.revision_context_manager.set_user(self.user)
action_view = self.admin_view
comment = action_view.description % model_format_dict(self.opts)
self.revision_context_manager.set_comment(comment)
return __()
return _method