Ashish Pitrodafield notes
All episodes

Wagtail Unboxed episode 09 4:17

Navigation and site settings

The studio site gets a real menu and a footer the client can edit. No menu model, no hard-coded links: the menu is built from the page tree, and the contact details come from Wagtail's site settings.

What this episode covers

And two reasons your first menu will be empty, or won't render at all.

What you'll learn

  • Building a menu from the page tree with in_menu()
  • A custom inclusion tag, and why the dev server says it doesn't exist
  • Why the menu is empty: show_in_menus, and what show_in_menus_default really does
  • Keeping the right item highlighted on child pages
  • Measuring the menu's cost: one query
  • wagtail.contrib.settings and its context processor
  • BaseSiteSetting vs BaseGenericSetting
  • The settings row that creates itself, and why defaults matter
  • settings.app_label.ModelName in templates, mailto and tel links

Chapters

  1. 0:00 A site you can't get around
  2. 0:22 The menu comes from the tree
  3. 0:39 An inclusion tag
  4. 0:53 Not a registered tag library
  5. 1:04 Restart runserver
  6. 1:24 The menu is empty
  7. 1:43 show_in_menus_default
  8. 1:59 Which item is active
  9. 2:18 One query
  10. 2:34 Site settings
  11. 2:44 A settings model
  12. 3:00 The row that creates itself
  13. 3:21 Using settings in templates
  14. 3:36 The menu on a post
  15. 3:43 The footer
  16. 3:57 Commit and tag
  17. 4:01 Next episode

Versions on screen

Wagtail 7.4.3 · Django 6.1.1 · Python 3.12. Recorded on Windows; macOS and Linux commands are in the repository for every episode.

Next: episode 10, Forms that work

Carry on from here.

Episode 10 or see all episodes