{"id":13530975,"url":"https://github.com/cfpb/wagtail-flags","last_synced_at":"2025-08-02T05:08:39.245Z","repository":{"id":16845796,"uuid":"80529037","full_name":"cfpb/wagtail-flags","owner":"cfpb","description":"Feature flags for Wagtail sites","archived":false,"fork":false,"pushed_at":"2024-07-05T18:52:58.000Z","size":981,"stargazers_count":84,"open_issues_count":2,"forks_count":15,"subscribers_count":34,"default_branch":"main","last_synced_at":"2025-06-22T14:01:58.218Z","etag":null,"topics":["django","hacktoberfest","python","wagtail"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cfpb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-31T14:44:48.000Z","updated_at":"2024-11-22T02:52:04.000Z","dependencies_parsed_at":"2024-01-07T13:11:43.895Z","dependency_job_id":"09d719fe-9b16-489e-bd60-1562dfdf0132","html_url":"https://github.com/cfpb/wagtail-flags","commit_stats":{"total_commits":188,"total_committers":17,"mean_commits":"11.058823529411764","dds":"0.32978723404255317","last_synced_commit":"f8efa2476ac4a70920e987859f42d64a356e20c0"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/cfpb/wagtail-flags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fwagtail-flags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fwagtail-flags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fwagtail-flags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fwagtail-flags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfpb","download_url":"https://codeload.github.com/cfpb/wagtail-flags/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fwagtail-flags/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268338131,"owners_count":24234540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","hacktoberfest","python","wagtail"],"created_at":"2024-08-01T07:00:58.644Z","updated_at":"2025-08-02T05:08:39.184Z","avatar_url":"https://github.com/cfpb.png","language":"Python","funding_links":[],"categories":["Python","Apps"],"sub_categories":["Settings management"],"readme":"# Wagtail-Flags\n\n[![Build Status](https://github.com/cfpb/wagtail-flags/workflows/test/badge.svg)](https://github.com/cfpb/wagtail-flags/actions?query=workflow%3Atest)\n[![Ethical open source](https://img.shields.io/badge/open-ethical-%234baaaa)](https://ethicalsource.dev/definition/)\n\nFeature flags allow you to toggle functionality based on configurable conditions.\n\nWagtail-Flags adds a Wagtail admin UI and Wagtail Site-based condition on top of [Django-Flags](https://github.com/cfpb/django-flags). For a more complete overview of feature flags and how to use them, please see the [Django-Flags documentation](https://cfpb.github.io/django-flags).\n\n![Feature flags in the Wagtail admin](wagtailflags.gif)\n\n- [Dependencies](#dependencies)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Extended conditions](#extended-conditions)\n- [Signals](#signals)\n- [Getting help](#getting-help)\n- [Getting involved](#getting-involved)\n- [Licensing](#licensing)\n- [Credits and references](#credits-and-references)\n\n## Dependencies\n\n- Python 3.8+\n- Django 4.2 (LTS)+\n- Django-Flags 5.0\n- Wagtail 6.0+\n\nIt should be compatible at all intermediate versions, as well.\nIf you find that it is not, please [file an issue](https://github.com/cfpb/wagtail-flags/issues/new).\n\n## Installation\n\n1. Install Django-Flags and Wagtail-Flags:\n\n```shell\npip install django-flags\npip install wagtail-flags\n```\n\n2. Add `flags` and `wagtailflags` as installed apps in your Django `settings.py`:\n\n ```python\n INSTALLED_APPS = (\n     ...\n     'flags',\n     'wagtailflags',\n     ...\n )\n```\n\n## Usage\n\nPlease see the [Django-Flags documentation](https://cfpb.github.io/django-flags) for the most current information about defining and checking feature flags.\n\nFirst, define the flag in Django `settings.py`:\n\n```python\nFLAGS = {\n    'MY_FLAG': []\n}\n```\n\nThen use the flag in a Django template (`mytemplate.html`):\n\n```django\n{% load feature_flags %}\n{% flag_enabled 'MY_FLAG' as my_flag %}\n\n{% if my_flag %}\n  \u003cdiv class=\"flagged-banner\"\u003e\n    I’m the result of a feature flag.\n  \u003c/div\u003e\n{% endif %}\n```\n\nNext, configure a URL for that template (`urls.py`):\n\n```python\nfrom django.urls import path\nfrom django.views.generic import TemplateView\n\nurlpatterns = [\n    path(r'mypage/', TemplateView.as_view(template_name='mytemplate.html')),\n]\n```\n\nFinally, add conditions for the flag in the Wagtail admin under \"Settings\", \"Flags\", \"MY_FLAG\":\n\n![Creating conditions in the Wagtail admin](screenshot_create.png)\n\n## Extended conditions\n\nWagtail-Flags adds the following conditions to Django-Flags:\n\n##### `site`\n\nAllows a flag to be enabled for a Wagtail site that matches the hostname and port in the condition value.\n\n```python\nFLAGS = {\n    'MY_FLAG': [\n        {'condition': 'site', 'value': 'staging.mysite.com'}\n    ],\n}\n```\n\n## Signals\n\nWagtail-Flags includes  `flag_enabled` and `flag_disabled` signals that can be received when the \"Enable for all requests\" and \"Disable for all requests\" buttons are pressed in the admin. This is intended to enable things like front-end cache invalidation.\n\n```python\nfrom django.dispatch import receiver\n\nfrom wagtail.contrib.frontend_cache.utils import purge_url_from_cache\n\nfrom wagtailflags.signals import flag_disabled, flag_enabled\n\n\n@receiver(flag_enabled)\ndef purge_on_flag_enabled(sender, **kwargs):\n    flag_name = kwargs[\"flag_name\"]\n    purge_url_from_cache(...)\n\n@receiver(flag_disabled)\ndef purge_on_flag_disabled(sender, **kwargs):\n    flag_name = kwargs[\"flag_name\"]\n    purge_url_from_cache(...)\n```\n\n**Please note:** These signals are only sent for manual presses of the \"Enable for all requests\" and \"Disable for all requests\" buttons in the admin. Other flag conditions may vary within and only be valid for a specific request cycle.\n\n## Getting help\n\nPlease add issues to the [issue tracker](https://github.com/cfpb/wagtail-flags/issues).\n\n## Getting involved\n\nGeneral instructions on _how_ to contribute can be found in [CONTRIBUTING](CONTRIBUTING.md).\n\n## Licensing\n1. [TERMS](TERMS.md)\n2. [LICENSE](LICENSE)\n3. [CFPB Source Code Policy](https://github.com/cfpb/source-code-policy/)\n\n## Credits and references\n\n1. Forked from [cfgov-refresh](https://github.com/cfpb/cfgov-refresh)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfpb%2Fwagtail-flags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfpb%2Fwagtail-flags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfpb%2Fwagtail-flags/lists"}