Skip to content

engineervix/wagtail-branching-workflows

Repository files navigation

Branching Workflows in Wagtail

Branching Workflows based on value of specified Page field.

Stack Overflow Question: https://stackoverflow.com/questions/69028083/

Blog Post: https://importthis.tech/wagtail-branching-workflows

Video Demo: https://youtu.be/qx1LOqJkt9Y

Continuous Integration Code style: black Commitizen friendly

Features ✨

Development 💻

First things first

Start by ensuring that you have Docker and Docker Compose:

# check that you have docker on your machine
docker -v

# check that you have docker-compose on your machine
docker-compose -v

Getting Started

Upon cloning this repository (or forking + cloning your fork), navigate to the cloned project directory: cd wagtail-branching-workflows

Then create the required .env files:

cp -v app/.envs/.dev.env.sample app/.envs/.dev.env
cp -v app/.envs/.test.env.sample app/.envs/.test.env

Build the images and spin up the containers:

docker-compose up -d --build

You'll have to wait a few seconds for some processes to initialize / run (postgres, database migrations, browser-sync, Django server, etc.). You can check the status via

docker-compose logs web

When all set, you should see something like this:

web_1  | Performing system checks...
web_1  |
web_1  | [Browsersync] Proxying: http://127.0.0.1:8000
web_1  | [Browsersync] Access URLs:
web_1  |  -----------------------------------
web_1  |        Local: http://localhost:3000
web_1  |     External: http://172.19.0.3:3000
web_1  |  -----------------------------------
web_1  |           UI: http://localhost:3001
web_1  |  UI External: http://localhost:3001
web_1  |  -----------------------------------
web_1  | [Browsersync] Watching files...
web_1  | System check identified no issues (0 silenced).
web_1  |
web_1  | Django version 3.2.8, using settings 'config.settings.dev'
web_1  | Development server is running at http://0.0.0.0:8000/
web_1  | Using the Werkzeug debugger (http://werkzeug.pocoo.org/)
web_1  | Quit the server with CONTROL-C.
web_1  | [Browsersync] Reloading Browsers... (buffered 2 events)
web_1  |  * Debugger is active!
web_1  |  * Debugger PIN: 104-102-219

You can now proceed to create a superuser:

docker-compose exec web ./manage.py createsuperuser

Load initial data:

docker-compose exec web ./manage.py load_initial_data

This initial data includes 6 users with the following details:

No. Email Address Password Group First Name Last Name
1 john.doe@example.com WriterPassword1 Writers John Doe
2 jane.doe@example.com WriterPassword2 Writers Jane Doe
3 another.writer@example.com WriterPassword3 Writers Another Writer
4 moderator.one@example.org ModeratorPassword1 Moderators Gina Stephenson
5 moderator.two@example.org ModeratorPassword2 Moderators George Benson
6 chief@example.org ApproverPassword0 Approvers Connie Montgomery

You can access the dev server at http://127.0.0.1:3009. This project uses MailDev for viewing and testing emails generated during development. The MailDev server is accessible at http://localhost:1089.

Tests

docker-compose exec web yarn test

Code Formatting

  • Run docker-compose exec web invoke lint to run flake8, black, isort on the code.
  • If you get any errors from black and/or isort, run docker-compose exec web invoke lint --fix or docker-compose exec web invoke lint -f so that black and isort can format your files.

Contributing 🤝

Contributions of any kind welcome! Please see CONTRIBUTING.md for guidelines on how to contribute. In addition, please note the following:

  • if you're making code contributions, please try and write some tests to accompany your code, and ensure that the tests pass. Also, were necessary, update the docs so that they reflect your changes.
  • commit your changes via git commit. Follow the prompts. When you're done, pre-commit will be invoked to ensure that your contributions and commits follow defined conventions. See pre-commit-config.yaml for more details.
  • your commit messages should follow the conventions described here. Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert. Once you are done, please create a pull request.

Credits 👏

This project's structure is based on the engineervix/cookiecutter-wagtail-vix project template.

Video Demo

Watch the video