當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。