本文整理汇总了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