Python wagtail.core.models.Page.settings_panels() Examples

The following are 4 code examples of wagtail.core.models.Page.settings_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 vote down vote up
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: models.py    From wagtail with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def get_edit_handler(cls):
        tabs = []

        if cls.basic_content_panels and cls.superuser_content_panels:
            tabs.append(PerUserContentPanels(heading='Content'))
        if cls.promote_panels:
            tabs.append(ObjectList(cls.promote_panels,
                                   heading='Promote'))
        if cls.settings_panels:
            tabs.append(ObjectList(cls.settings_panels,
                                   heading='Settings',
                                   classname='settings'))

        edit_handler = TabbedInterface(tabs,
                                       base_form_class=cls.base_form_class)

        return edit_handler.bind_to(model=cls) 
Example #3
Source File: calendar.py    From ls.joyous with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def registerImportHandler(cls, handler):
        class Panel(ConcealedPanel):
            def _show(self):
                page = getattr(self, 'instance', None)
                if not page:
                    return False
                hasReq = hasattr(page, '__joyous_edit_request')
                if not hasReq:
                    return False
                # only a user with edit and publishing rights should be able
                # to import iCalendar files
                perms = page.permissions_for_user(self.request.user)
                return perms.can_publish() and perms.can_edit()

        cls.importHandler = handler
        uploadWidget = forms.FileInput(attrs={'accept': "text/calendar,"
                                                        "application/zip,"
                                                        ".ics,.zip"})
        cls.declared_fields['upload'] = forms.FileField(
                                            label=_("Upload"),
                                            required=False,
                                            widget=uploadWidget)
        cls.declared_fields['utc2local'] = forms.BooleanField(
                                            label=_("Convert UTC to localtime?"),
                                            required=False,
                                            initial=True)
        CalendarPage.settings_panels.append(Panel([
              FieldPanel('upload'),
              FieldPanel('utc2local'),
            ], heading=_("Import"))) 
Example #4
Source File: calendar.py    From ls.joyous with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def registerExportHandler(cls, handler):
        class Panel(ConcealedPanel):
            def _show(self):
                page = getattr(self, 'instance', None)
                return page and page.url is not None and page.live

        cls.exportHandler = handler
        CalendarPage.settings_panels.append(Panel([
              HelpPanel(template="joyous/edit_handlers/export_panel.html")
            ], heading=_("Export")))