本文整理汇总了Python中wagtail.wagtailadmin.edit_handlers.ObjectList.bind_to_model方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectList.bind_to_model方法的具体用法?Python ObjectList.bind_to_model怎么用?Python ObjectList.bind_to_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wagtail.wagtailadmin.edit_handlers.ObjectList
的用法示例。
在下文中一共展示了ObjectList.bind_to_model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_edit_handler_class
# 需要导入模块: from wagtail.wagtailadmin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.wagtailadmin.edit_handlers.ObjectList import bind_to_model [as 别名]
def get_edit_handler_class(self):
if hasattr(self.model, 'edit_handler'):
edit_handler = self.model.edit_handler
else:
panels = extract_panel_definitions_from_model_class(self.model)
edit_handler = ObjectList(panels)
return edit_handler.bind_to_model(self.model)
示例2: get_edit_handler_class
# 需要导入模块: from wagtail.wagtailadmin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.wagtailadmin.edit_handlers.ObjectList import bind_to_model [as 别名]
def get_edit_handler_class(self):
if hasattr(self.model, 'edit_handler'):
edit_handler = self.model.edit_handler
else:
fields_to_exclude = self.model_admin.get_form_fields_exclude(request=self.request)
panels = extract_panel_definitions_from_model_class(self.model, exclude=fields_to_exclude)
edit_handler = ObjectList(panels)
return edit_handler.bind_to_model(self.model)
示例3: get_snippet_edit_handler
# 需要导入模块: from wagtail.wagtailadmin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.wagtailadmin.edit_handlers.ObjectList import bind_to_model [as 别名]
def get_snippet_edit_handler(model):
if model not in SNIPPET_EDIT_HANDLERS:
if hasattr(model, 'edit_handler'):
# use the edit handler specified on the page class
edit_handler = model.edit_handler
else:
panels = extract_panel_definitions_from_model_class(model)
edit_handler = ObjectList(panels)
SNIPPET_EDIT_HANDLERS[model] = edit_handler.bind_to_model(model)
return SNIPPET_EDIT_HANDLERS[model]
示例4: edit_handler_class
# 需要导入模块: from wagtail.wagtailadmin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.wagtailadmin.edit_handlers.ObjectList import bind_to_model [as 别名]
def edit_handler_class(self, model):
"""A GenericModelChooserPanel class that works on
PageChooserModel's 'page' field
"""
object_list = ObjectList([GenericModelChooserPanel('page')])
return object_list.bind_to_model(model)