Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (83 sloc) 3.02 KB


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


  • Python 2.7+, 3.6+
  • Django 1.11+, 2.0+
  • Wagtail 1.13+, 2.0+
  • Django-Flags 4.2+


  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


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

First, define the flag in Django

    '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.   
{% endif %}

Next, configure a URL for that template (

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:


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

    'MY_FLAG': [
        {'condition': 'site', 'value': ''}

Getting help

Please add issues to the issue tracker.

Getting involved

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


  1. TERMS
  3. CFPB Source Code Policy

Credits and references

  1. Forked from cfgov-refresh
You can’t perform that action at this time.