Steven Abadie

Product Designer | Software Developer

I'm developing sustainable products at Ninebark.io and provide consulting services for growing businesses. I write here about my experiences building physical and software products.

Wagtail CMS

Out of the box Django comes with a useful admin interface that allows basic editing of data. However, for more complex tasks or customization Django suggests creating your own admin views. If you're working on a quick blog or other projects that will handle content creation it can be time consuming to make custom admin views.

In comes Wagtail CMS, a content management system for Django. Wagtail provides a number of features including a rich text editor, content explorer, and advanced image handling to name a few. The most immediate difference you will notice is a completely redesigned admin interface. The admin interface has been so well designed I would question spending time on a custom admin interface if your project is largely going to be content management focused.

Draftail and Streamfield

Wagtail includes a number of tools for editing content. A recent addition, starting in Wagtail v2.0, Draftail is a configurable rich text editor. By default with Wagtail, Draftail is configured with basic text formatting, unordered and ordered lists, video embedding, links, and images. Draftail can be further configured to include formats for code, highlight, and strike-through. See the Draftail examples page for examples of possible configurations or customization.

For more complex content management Wagtail provides the Streamfield feature. Streamfield allows creating free-form pages with a selection of pre-existing content blocks or any custom blocks you create. The possibility of blocks range wide from a simple text block to a custom block to render tables. Check out the Streamfield video demo and the Streamfield documentation for more info.

Image Handling

Working with images in Wagtail is simple with the admin image manager, page image selector, and image rendering tools. The image manager allows uploading and deleting images, adding image titles and tags, and setting the image focal point for automated cropping. The focal point selection is notable as it is used by the Wagtail template tags which can automate cropping and resizing of images. This allows you to upload larger size images in the image manager and then rely on your template settings to crop or resize images for rendering on pages. The focal point will be considered in the resizing to keep the focal point in the rendered image. An example use of the wagtail template image tag:

The fill rule will take a larger image and crop it to 500x300 pixels. In this case the focal point setting is taken into consideration as the center point of the crop. You can find out much more about the image template tags on the Wagtail Using images in templates documentation page.

Other Features

Wagtail provides a number of other features you would expect from a CMS including permissions and role management, a very well done content search using Elasticsearch, document management, and a form builder. As you would expect from Python and Django, Wagtail also has a number of available supporting contributed modules including site settings, sitemap generator, menu management, and content tagging.

The Wagtail page model and Wagtail API provides a number of simplifications of Django to minimize some of the work required for quickly creating simple websites. For example, the Wagtail page model automatically generates URL mappings, template tags, and views. However, caution for new Django developers as you should still learn how URL mapping, template tags, and views work in Django. As your projects get more complex it is likely you will need to manually create URL mappings, template tags, and views.

For more info about Wagtail CMS there are number of useful resources including wagtail.io for a high level overview, The Zen of Wagtail which defines the code and design principles of the project, and docs.wagtail.io which provides thorough documentation of the project. If you are interested in giving Wagtail CMS a try, start by going through the quick Your first Wagtail site guide in the Wagtail docs.