Python wagtail.core.models.Page.content_panels() Examples
The following are 3
code examples of wagtail.core.models.Page.content_panels().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wagtail.core.models.Page
, or try the search function
.
Example #1
Source File: edit_handlers.py From wagtail with BSD 3-Clause "New" or "Revised" License | 6 votes |
def get_edit_handler(cls): """ Get the EditHandler to use in the Wagtail admin when editing this page type. """ if hasattr(cls, 'edit_handler'): edit_handler = cls.edit_handler else: # construct a TabbedInterface made up of content_panels, promote_panels # and settings_panels, skipping any which are empty tabs = [] if cls.content_panels: tabs.append(ObjectList(cls.content_panels, heading=gettext_lazy('Content'))) if cls.promote_panels: tabs.append(ObjectList(cls.promote_panels, heading=gettext_lazy('Promote'))) if cls.settings_panels: tabs.append(ObjectList(cls.settings_panels, heading=gettext_lazy('Settings'), classname='settings')) edit_handler = TabbedInterface(tabs, base_form_class=cls.base_form_class) return edit_handler.bind_to(model=cls)
Example #2
Source File: events.py From ls.joyous with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _copyFieldsFromParent(self, parent): """ Copy across field values from the recurring event parent. """ super()._copyFieldsFromParent(parent) parentFields = set() for panel in parent.content_panels: parentFields.update(panel.required_fields()) pageFields = set() for panel in self.content_panels: pageFields.update(panel.required_fields()) commonFields = parentFields & pageFields for name in commonFields: setattr(self, name, getattr(parent, name)) if self.except_date: self.date = self.except_date + dt.timedelta(days=1) self.postponement_title = parent.title # ------------------------------------------------------------------------------
Example #3
Source File: events.py From ls.joyous with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _removeContentPanels(cls, *args): """ Remove the panels and so hide the fields named. """ remove = [] for arg in args: if type(arg) is str: remove.append(arg) else: remove.extend(arg) cls.content_panels = _filterContentPanels(cls.content_panels, remove)