Skip to main content

Wagtail-Flags

Build Status Ethical open source

Feature flags allow you to toggle functionality based on configurable conditions.

Wagtail-Flags adds a Wagtail admin UI and Wagtail Site-based condition on top of Django-Flags. For a more complete overview of feature flags and how to use them, please see the Django-Flags documentation.

Feature flags in the Wagtail admin

Dependencies

  • Python 3.13 – 3.14
  • Django 5.2 (LTS) – 6.0
  • Django-Flags 5.0+
  • Wagtail 7.0 (LTS) – 7.4 (LTS)

It should be compatible at all intermediate versions, as well. If you find that it is not, please file an issue.

Installation

  1. Install Django-Flags and Wagtail-Flags:
pip install django-flags
pip install wagtail-flags
  1. Add flags and wagtailflags as installed apps in your Django settings.py:
INSTALLED_APPS = (
    ...
    'flags',
    'wagtailflags',
    ...
)

Usage

Please see the Django-Flags documentation for the most current information about defining and checking feature flags.

First, define the flag in Django settings.py:

FLAGS = {"MY_FLAG": []}

Then use the flag in a Django template (mytemplate.html):

{% load feature_flags %}
{% flag_enabled 'MY_FLAG' as my_flag %}

{% if my_flag %}
  <div class="flagged-banner">
    I’m the result of a feature flag.
  </div>
{% endif %}

Next, configure a URL for that template (urls.py):

from django.urls import path
from django.views.generic import TemplateView

urlpatterns = [
    path(r"mypage/", TemplateView.as_view(template_name="mytemplate.html")),
]

Finally, add conditions for the flag in the Wagtail admin under "Settings", "Flags", "MY_FLAG":

Creating conditions in the Wagtail admin

Extended conditions

Wagtail-Flags adds the following conditions to Django-Flags:

site

Allows a flag to be enabled for a Wagtail site that matches the hostname and port in the condition value.

FLAGS = {
    "MY_FLAG": [{"condition": "site", "value": "staging.mysite.com"}],
}

Signals

Wagtail-Flags includes flag_enabled and flag_disabled signals that can be received when the "Enable for all requests" and "Disable for all requests" buttons are pressed in the admin. This is intended to enable things like front-end cache invalidation.

from django.dispatch import receiver

from wagtail.contrib.frontend_cache.utils import purge_url_from_cache

from wagtailflags.signals import flag_disabled, flag_enabled


@receiver(flag_enabled)
def purge_on_flag_enabled(sender, **kwargs):
    flag_name = kwargs["flag_name"]
    purge_url_from_cache(...)


@receiver(flag_disabled)
def purge_on_flag_disabled(sender, **kwargs):
    flag_name = kwargs["flag_name"]
    purge_url_from_cache(...)

Please note: These signals are only sent for manual presses of the "Enable for all requests" and "Disable for all requests" buttons in the admin. Other flag conditions may vary within and only be valid for a specific request cycle.

Getting help

Please add issues to the issue tracker.

Getting involved

General instructions on how to contribute can be found in CONTRIBUTING.

Licensing

  1. TERMS
  2. LICENSE
  3. CFPB Source Code Policy

Credits and references

  1. Forked from cfgov-refresh

Metadata

Release files for wagtail-flags 5.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-flags 5.6.0
File Size Uploaded
wagtail_flags-5.6.0.tar.gz 249.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-flags 5.6.0
File Interpreter ABI Platform
wagtail_flags-5.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 272.7 kB

Release files / wagtail_flags-5.6.0.tar.gz

Download URL wagtail_flags-5.6.0.tar.gz
Size 249.6 kB
Tags Source
SHA-256 checksum
How to use checksums
facc1abe9e85cf0e1412defe1cc753da19e081b7603cfdcabd0da023e1ea6753
BLAKE2b-256 checksum
How to use checksums
fdc5a6ee7ba7e099b053ccd3978f9aa0c5d298326efb817915080eb417a65067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / wagtail_flags-5.6.0-py3-none-any.whl

Download URL wagtail_flags-5.6.0-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec3532034487b4656a5869adbdceb702b1eb27b158479156fb81ecf7eea29aca
BLAKE2b-256 checksum
How to use checksums
625379d6e7d529e0489412b53fc20ff0a907ef4d3b3aa1909bbbd5957cf52fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.6.0 This release

2 release files

5.5.0

2 release files

5.4.0

2 release files

5.3.1

2 release files

5.3.0

2 release files

5.2.0

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.2.2

2 release files

4.2.1

2 release files

4.1.1

2 release files

4.1.0

3 release files

4.0.3

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.8

2 release files

2.0.7

3 release files

2.0.6

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page