Building blocks for interactive regulations in Wagtail.
- Django 1.11+ (including Django 2.0+)
- Wagtail 1.13+ (including Wagtail 2.0+)
- Python 2.7+, 3.6+
Wagtail Regulations provides the building blocks to create and serve interactive US federal regulations on existing Wagtail sites. It is intended to integrate into sites that may have their base templates, design language and components, and Wagtail base pages. It also provides everything needed to stand-up a new interactive regulations site using the US Web Design System.
The basic components are as follows:
Wagtail Regulations includes Django models that represent regulations, their effective versions, subparts, and sections.
Regulation content is stored in Section
objects in Markdown outside of the
Wagtail page tree.
Regulation pages are routable Wagtail pages that live in the Wagtail page tree and serve the regulation content from the regulation content. Regulation pages can be used two ways:
- By inheriting from the abstract
wagtailregulations.RegulationPage
model directly. - By creating a new page model using any
Page
subclass andRegulationPageMixin
.
Regulation content is indexed and searchable using Haystack.
The API provides access to the regulation pages and their content so that a frontend can consume it.
The frontend serves the regulation content and search to end users.
This repository comes with the Wagtail library to build an interative federal regulations website as well as a functioning example of how to do so.
The example is broken into a Wagtail-based REST API and a Gatsy-based front-end using the US Web Design System v2.0 that consumes that API.
The API can be run using Docker with Docker Compose:
docker-compose up
To load example regulation data with the necessary Wagtail pages you'll need to create a superuser and then load the data:
docker-compose run app /venv/bin/python manage.py createsuperuser --username admin --email test@example.com
docker-compose run app /venv/bin/python manage.py loaddata sample_data.json
The regulation data should then be available at http://localhost:8000/api/v2/pages/4
Please add issues to the issue tracker.
General instructions on how to contribute can be found in CONTRIBUTING.
- Forked from cfgov-refresh