예제 #1
0
    def get_context_data(self, **kwargs):
        request = self.request

        panels = [
            SiteSummaryPanel(request),
            UpgradeNotificationPanel(request),
            PagesForModerationPanel(request),
            RecentEditsPanel(request),
            RecentActivityPanel(request)
        ]

        for fn in hooks.get_hooks('construct_homepage_panels'):
            fn(request, panels)

        root_page = get_explorable_root_page(request.user)
        if root_page:
            root_site = root_page.get_site()
        else:
            root_site = None

        real_site_name = None
        if root_site:
            real_site_name = root_site.site_name if root_site.site_name else root_site.hostname
        return {
            'root_page': root_page,
            'root_site': root_site,
            'site_name': real_site_name if real_site_name else settings.WAGTAIL_SITE_NAME,
            'panels': sorted(panels, key=lambda p: p.order),
            'user': request.user
        }
예제 #2
0
def home(request):

    panels = [
        SiteSummaryPanel(request),
        UpgradeNotificationPanel(request),
        WorkflowPagesToModeratePanel(request),
        PagesForModerationPanel(request),
        UserPagesInWorkflowModerationPanel(request),
        RecentEditsPanel(request),
        LockedPagesPanel(request),
    ]

    for fn in hooks.get_hooks('construct_homepage_panels'):
        fn(request, panels)

    site_details = get_site_for_user(request.user)

    return TemplateResponse(
        request, "wagtailadmin/home.html", {
            'root_page': site_details['root_page'],
            'root_site': site_details['root_site'],
            'site_name': site_details['site_name'],
            'panels': sorted(panels, key=lambda p: p.order),
            'user': request.user
        })
예제 #3
0
파일: home.py 프로젝트: melody40/monorepo
def home(request):

    panels = [
        SiteSummaryPanel(request),
        UpgradeNotificationPanel(request),
        PagesForModerationPanel(request),
        RecentEditsPanel(request),
    ]

    for fn in hooks.get_hooks('construct_homepage_panels'):
        fn(request, panels)

    root_page = get_explorable_root_page(request.user)
    if root_page:
        root_site = root_page.get_site()
    else:
        root_site = None

    real_site_name = None
    if root_site:
        real_site_name = root_site.site_name if root_site.site_name else root_site.hostname

    return render(request, "wagtailadmin/home.html", {
        'root_page': root_page,
        'root_site': root_site,
        'site_name': real_site_name if real_site_name else settings.WAGTAIL_SITE_NAME,
        'panels': sorted(panels, key=lambda p: p.order),
        'user': request.user
    })
예제 #4
0
파일: home.py 프로젝트: tomkins/wagtail
def home(request):

    panels = [
        SiteSummaryPanel(request),
        UpgradeNotificationPanel(),
        WorkflowPagesToModeratePanel(),
        PagesForModerationPanel(),
        UserPagesInWorkflowModerationPanel(),
        RecentEditsPanel(),
        LockedPagesPanel(),
    ]

    for fn in hooks.get_hooks("construct_homepage_panels"):
        fn(request, panels)

    media = Media()

    for panel in panels:
        media += panel.media

    site_details = get_site_for_user(request.user)

    return TemplateResponse(
        request,
        "wagtailadmin/home.html",
        {
            "root_page": site_details["root_page"],
            "root_site": site_details["root_site"],
            "site_name": site_details["site_name"],
            "panels": sorted(panels, key=lambda p: p.order),
            "user": request.user,
            "media": media,
        },
    )
예제 #5
0
파일: home.py 프로젝트: tnir/wagtail
    def get_panels(self):
        request = self.request
        panels = [
            SiteSummaryPanel(request),
            UpgradeNotificationPanel(),
            WorkflowPagesToModeratePanel(),
            PagesForModerationPanel(),
            UserPagesInWorkflowModerationPanel(),
            RecentEditsPanel(),
            LockedPagesPanel(),
        ]

        for fn in hooks.get_hooks("construct_homepage_panels"):
            fn(request, panels)

        return panels
예제 #6
0
파일: home.py 프로젝트: tomusher/wagtail
def home(request):

    panels = [
        SiteSummaryPanel(request),
        UpgradeNotificationPanel(),
        WorkflowPagesToModeratePanel(),
        PagesForModerationPanel(),
        UserPagesInWorkflowModerationPanel(),
        RecentEditsPanel(),
        LockedPagesPanel(),
    ]

    for fn in hooks.get_hooks('construct_homepage_panels'):
        fn(request, panels)

    media = Media()

    for panel in panels:
        if hasattr(panel, 'render') and not hasattr(panel, 'render_html'):
            # NOTE: when this deprecation warning is removed the 'fallback_render_method=True' in
            # wagtailadmin/home.html should be removed too
            message = (
                "Homepage panel %r should provide a render_html method. "
                "See https://docs.wagtail.org/en/stable/releases/2.15.html#template-components-2-15"
                % panel)
            warn(message, category=RemovedInWagtail217Warning)

        # RemovedInWagtail217Warning: this hasattr check can be removed when support for
        # non-component-based panels ends
        if hasattr(panel, 'media'):
            media += panel.media

    site_details = get_site_for_user(request.user)

    return TemplateResponse(
        request, "wagtailadmin/home.html", {
            'root_page': site_details['root_page'],
            'root_site': site_details['root_site'],
            'site_name': site_details['site_name'],
            'panels': sorted(panels, key=lambda p: p.order),
            'user': request.user,
            'media': media,
        })