Skip to main content

Wagtail-Flags

Build Status Coverage Status

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.6, 3.8
  • Wagtail 2.3, 2.9
  • Django 1.11, 2.2
  • Django-Flags 4.2+

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'}
    ],
}

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

Release files for wagtail-flags 4.2.1

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 4.2.1
File Size Uploaded
wagtail-flags-4.2.1.tar.gz 13.1 kB Details

Built distribution (wheel)

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

Total release size: 32.9 kB

Release files / wagtail-flags-4.2.1.tar.gz

Download URL wagtail-flags-4.2.1.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cdb054ae5b0a8d745ebe8ea19f07b837ab00a391f036a2a0737f085359700587
BLAKE2b-256 checksum
How to use checksums
9b470475a46522bd095330b1603f0ace0cc3ac1940bc8dd6075b1d42244c9e8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

Release files / wagtail_flags-4.2.1-py2.py3-none-any.whl

Download URL wagtail_flags-4.2.1-py2.py3-none-any.whl
Size 19.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4f4a5db007fdd7fe7da5f3209b1a6c75665c192d6904b0b73f7a4a9437dd8fde
BLAKE2b-256 checksum
How to use checksums
1069670baa692b9b8a1caddd65e73560342248f77106bf2c4b05a8f6e1436c81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

Release history Release notifications | RSS feed

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

This release

4.2.1 This release

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