当前位置: 首页>>代码示例>>Python>>正文


Python ObjectList.bind_to_model方法代码示例

本文整理汇总了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)
开发者ID:balazs-endresz,项目名称:wagtail,代码行数:10,代码来源:views.py

示例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]
开发者ID:kaedroho,项目名称:wagtail,代码行数:14,代码来源:snippets.py

示例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)
开发者ID:ababic,项目名称:wagtailmenus,代码行数:14,代码来源:views.py

示例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)
开发者ID:infoportugal,项目名称:wagtail-modeltranslation,代码行数:16,代码来源:patch_wagtailadmin.py


注:本文中的wagtail.admin.edit_handlers.ObjectList.bind_to_model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。