Back to articles
Wagtail Routable Pages and Layout Configuration

Wagtail Routable Pages and Layout Configuration

via Dev.to WebdevAidas Bendoraitis

If you are familiar with Wagtail CMS for Django, you know that you can create Wagtail pages and control their content and layout with blocks inside of stream fields. But what if you have entries coming from normal Django models through a routable page? In this article, I will explore how you can control the dynamic layout of a detail view in a routable page. Routable pages in Wagtail are dynamic pages of your CMS page tree that can have their own URL subpaths and views. You can use them for filtered list and detail views, multi-step forms, multiple formats for the same data, etc. Here I will show you a routable ArticleIndexPage with a list and detail views for Article instances rendering the detail views based on the block layout in a detail_layout stream field. 1. Project Setup Create a Wagtail project myproject and articles app: pip install wagtail wagtail start myproject cd myproject python manage.py startapp articles Add to INSTALLED_APPS in your Django project settings: INSTALLED_

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles