Skip to main content

Feature flags for Wagtail sites

Project description

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 2.7+, 3.6+
  • Django 1.11+, 2.0+
  • Wagtail 1.13+, 2.0+
  • Django-Flags 4.2+

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail-flags-4.1.0b1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

wagtail_flags-4.1.0b1-py2.py3-none-any.whl (20.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wagtail-flags-4.1.0b1.tar.gz.

File metadata

  • Download URL: wagtail-flags-4.1.0b1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for wagtail-flags-4.1.0b1.tar.gz
Algorithm Hash digest
SHA256 295e3a4a108a20243b39815b04510e5dda8434b6b923dbbc15403c6e8c825626
MD5 8d6d7977afc0289037640f609ca309f3
BLAKE2b-256 5e7d05c3596ee92e3b8dbb65d76364a17f31ebda3746f253f9c89cc17c97b0b9

See more details on using hashes here.

Provenance

File details

Details for the file wagtail_flags-4.1.0b1-py2.py3-none-any.whl.

File metadata

  • Download URL: wagtail_flags-4.1.0b1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for wagtail_flags-4.1.0b1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0af5bd3a8109e3c5ebe2445bca157278e088599d5aeedcce59903730252a9b03
MD5 5242d66b7f08526f72e050ca06d6b886
BLAKE2b-256 75aed55e618b7525b2d286bb6ac6061fb941b33bdaa87bd75a12c734c23ed57c

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page