- Django >= 1.9
- Wagtail >= 1.9 (for ParentalManyToMany)
- Bootstrap >= 3 (optimized for Bootstrap 4; templates can be modified)
These installation instructions assume you are using Wagtail 2.0 or greater.
This installation assumes that you already have Django and Wagtail installed as part of your project.
Wagtail Gridder can then be installed like most Django apps. First, install it into your
pip install wagtailgridder
wagtailgridder to your list of
INSTALLED_APPS in your Django settings file. You will also need to add
wagtail.contrib.modeladmin, if you haven't already. Your final settings may look something like this:
WAGTAIL_APPS = [ 'taggit', 'modelcluster', 'wagtail.core', 'wagtail.admin', 'wagtail.documents', 'wagtail.snippets', 'wagtail.users', 'wagtail.images', 'wagtail.embeds', 'wagtail.search', 'wagtail.sites', ] WAGTAIL_CONTRIB_APPS = [ 'wagtailgridder', 'wagtail.contrib.modeladmin', ] INSTALLED_APPS = INSTALLED_APPS + WAGTAIL_APPS + WAGTAIL_CONTRIB_APPS
This Wagtail Gridder template extends
base.html, with the hope that this allows inclusion or your site's top and bottom navigation without much effort. There is an example base.html provided.
Then log into the Wagtail admin, and you should see a "Grid Layouts" section of the menu. The first thing you will want to do is add some "Grid Categories." After that, you can create "Grid Items" (the cards, pictured below) and put them together on a "Grid Index Page."
WAGTAILGRIDDER_CLEAR_CACHE = False
The default Wagtail Gridder template caches the grid display area to reduce the number of queries performed. Setting
WAGTAILGRIDDER_CLEAR_CACHE = True in your Django settings will clear the entire Django cache after a page is edited. This approach is necessary, as Django does not currently support deletion from the cache by pattern. Setting this to
True will clear your cache every time you save a Wagtail page. If anyone knows of a better solution that works for Django's supported cache systems, please let us know!
Grid Index Page:
Grid Index Page, with Grid Item expanded:
Optional featured hero region:
Grid Item landing page:
Editing a Grid Item:
Editing a Grid Index Page:
- Wagtail 2.0 compatibility.
- Bugfix: a bad relation in
search_fieldsof GridIndexPage caused problems for Elastic Search.