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
- Wagtail 2.3, 2.9, 2.10
- 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
- Install Django-Flags and Wagtail-Flags:
pip install django-flags
pip install wagtail-flags
- Add
flagsandwagtailflagsas 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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagtail-flags-4.2.2.tar.gz.
File metadata
- Download URL: wagtail-flags-4.2.2.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95382ec6ba9993341415198eee11c063daabb160f228a7d178e10ce114c38f07
|
|
| MD5 |
3551f84521fc832f73fe79bc531c7973
|
|
| BLAKE2b-256 |
6acd49c7af9cebde538bbd59cabeb92cf5de00f2158638b1e981922273efb6ef
|
File details
Details for the file wagtail_flags-4.2.2-py2.py3-none-any.whl.
File metadata
- Download URL: wagtail_flags-4.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9ec88b82f4958d4233c52a945f59a664d30741edb94a76998e8afeaca0e56f2
|
|
| MD5 |
0442e54a7483b7b016864cb9aeec4497
|
|
| BLAKE2b-256 |
8db8eab347993a6eb421f07654954e3c0155b7bc3ad5d9ada284b446fd2c1082
|