Skip to content

Instantly share code, notes, and snippets.

View koslib's full-sized avatar

Konstantinos Livieratos koslib

View GitHub Profile
@bgrace
bgrace / gist:a5216b4059007924a75c
Last active February 16, 2018 18:35
Mixed navigation menus for Wagtail CMS
# Notes:
# Python 3 assumed, but shouldn't be hard to backport to Python 2
# Cobbled together from two slightly different implementations, sorry for any inconsistencies.
# This creates two models, NavigationMenu, and NavigationMenuItem. A site can have many NavigationMenus, which are referenced from
# the template by location. E.g., 'footer', 'left_nav'. You can also create single-item lists for special purpose links/buttons,
# such a privacy_policy or homepage_cta. This helps to reduce hard coding in templates.
# NavigationMenuItem mixes in some different link types (Page, Document, URL) and presents them in a consistent way. It provides
# the ability to override the title of the referenced object.