本文整理汇总了Python中wagtail.admin.edit_handlers.ObjectList.bind_to_model方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectList.bind_to_model方法的具体用法?Python ObjectList.bind_to_model怎么用?Python ObjectList.bind_to_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wagtail.admin.edit_handlers.ObjectList
的用法示例。
在下文中一共展示了ObjectList.bind_to_model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_edit_handler
# 需要导入模块: from wagtail.admin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.admin.edit_handlers.ObjectList import bind_to_model [as 别名]
def get_edit_handler(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)
示例2: get_snippet_edit_handler
# 需要导入模块: from wagtail.admin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.admin.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]
示例3: get_edit_handler
# 需要导入模块: from wagtail.admin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.admin.edit_handlers.ObjectList import bind_to_model [as 别名]
def get_edit_handler(self):
if hasattr(self.model, 'edit_handler'):
edit_handler = self.model.edit_handler
elif hasattr(self.model, 'panels'):
edit_handler = ObjectList(self.model.panels)
else:
edit_handler = TabbedInterface([
ObjectList(self.model.content_panels, heading=_("Content")),
ObjectList(self.model.settings_panels, heading=_("Settings"),
classname="settings"),
])
return edit_handler.bind_to_model(self.model)
示例4: _patch_other_models
# 需要导入模块: from wagtail.admin.edit_handlers import ObjectList [as 别名]
# 或者: from wagtail.admin.edit_handlers.ObjectList import bind_to_model [as 别名]
def _patch_other_models(self, model):
if hasattr(model, 'edit_handler'):
edit_handler = model.edit_handler
for tab in edit_handler:
tab.children = self._patch_panels(tab.children)
elif hasattr(model, 'panels'):
model.panels = self._patch_panels(model.panels)
else:
panels = extract_panel_definitions_from_model_class(model)
translation_registered_fields = translator.get_options_for_model(model).fields
panels = filter(lambda field: field.field_name not in translation_registered_fields, panels)
edit_handler = ObjectList(panels)
SNIPPET_EDIT_HANDLERS[model] = edit_handler.bind_to_model(model)