Feature flags for Wagtail sites
Project description
Wagtail-Flags
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.
- Dependencies
- Installation
- Usage
- Extended conditions
- Getting help
- Getting involved
- Licensing
- Credits and references
Dependencies
- Python 3.6, 3.8
- Django 1.11, 2.0, 2.2
- Wagtail 1.13, 2.3, 2.8
- 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
- Install Django-Flags and Wagtail-Flags:
pip install django-flags
pip install wagtail-flags
- Add
flags
andwagtailflags
as installed apps in your Djangosettings.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":
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
Credits and references
- Forked from cfgov-refresh
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file wagtail-flags-4.1.0.tar.gz
.
File metadata
- Download URL: wagtail-flags-4.1.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a01065538bb8a85552985d7d18ad971dc8da07f1cffd009571db9033a6c360a |
|
MD5 | 89698fb83f92b51c6dd8e6babc75039e |
|
BLAKE2b-256 | f64618abe06f3617eaa737434d0d36917e23dcc400d07c8a8f236e2a8824cb86 |
Provenance
File details
Details for the file wagtail_flags-4.1.0-py3-none-any.whl
.
File metadata
- Download URL: wagtail_flags-4.1.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcf6ad1b467e1279f973be7698a282f044f476ea0ed86e47a84aa02e4a36275b |
|
MD5 | 81fb66a14531d6313611ef37926a7464 |
|
BLAKE2b-256 | f6ff477dd41d6de14c63890dd376579029f1715155f1bf804e70d97835a7d291 |
Provenance
File details
Details for the file wagtail_flags-4.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: wagtail_flags-4.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 855ebde21157fb5c799553409f5d517c20cbbca6720be15bf284441564722c87 |
|
MD5 | c577aa302d7ca44cf0d377d9d43fb5e6 |
|
BLAKE2b-256 | 06d8bd6d4a84426f8939e04970643ce17089d3639024a23da371872f40ecea55 |