Skip to main content

Full navigation header, menus, sub menus, internal and external links and documents, simple integrated design.

Project description

Wagtail Header

Full navigation header, menus, sub menus, internal and external links and documents, simple integrated design.

Version Python: ^3
Version django: ^3
Version wagtail: ^2.8

Installation

  • pip install menu_header_wagtail
  • Add menu_header_wagtail to your installed apps
  • Run migrations ./ manage.py migrate

Usage

  • Import in models of app

my_app/models.py

from menu_header_wagtail.models import HeaderPage
  • Add the model HeaderPage to the page model as ForeignKey in your HomePage or other pages
class HomePage(Page):
    header = models.ForeignKey(
        HeaderPage,
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )
    ...

and then in content

    ...
    content_panels = Page.content_panels + [
        SnippetChooserPanel('header'),
        ...
    ]

And to render:

  • Load tag and pass param page
{% load menu_header_wagtail_tag %}

{% render_header_ui page %}

NOTE: If you have nested pages, then use the get_parent_page tag and the child page as a parameter.

When you get it, you must indicate the type of page that the parent is: page_parent.{type_page}

{% get_parent_page page as page_parent %}

{% render_header page_parent.homepage %}
  • And finally, stop and start server

Using this type of menu is important because it allows you to reuse as well as create different ones for different pages.

Made with ♥ by Jose Florez

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for menu-header-wagtail, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size menu_header_wagtail-1.0.1-py3-none-any.whl (15.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size menu_header_wagtail-1.0.1.tar.gz (11.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page