Add Django Waffle integration (#2078)

This commit is contained in:
Greg Kaleka
2026-02-17 14:05:02 -05:00
committed by GitHub
parent 43f7ff4ac1
commit af5af4ba15
5 changed files with 38 additions and 0 deletions

View File

@@ -67,6 +67,7 @@ INSTALLED_APPS = [
# Third-party apps
INSTALLED_APPS += [
"waffle",
"anymail",
"rest_framework",
"corsheaders",
@@ -145,8 +146,13 @@ MIDDLEWARE = [
"allauth.account.middleware.AccountMiddleware",
"oauth2_provider.middleware.OAuth2TokenMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
"waffle.middleware.WaffleMiddleware",
]
# django-waffle settings
WAFFLE_CREATE_MISSING_FLAGS = True
WAFFLE_FLAG_DEFAULT = False
if DEBUG:
# These are necessary to turn on Whitenoise which will serve our static
# files while doing local development

View File

@@ -14,6 +14,7 @@ django-import-export
django-oauth-toolkit
django-redis
django-upgrade
django-waffle
django-widget-tweaks
djangorestframework
environs[django]

View File

@@ -145,6 +145,7 @@ django==6.0.2
# django-taggit
# django-tasks
# django-treebeard
# django-waffle
# django-widget-tweaks
# djangorestframework
# laces
@@ -213,6 +214,8 @@ django-treebeard==4.8.0
# via wagtail
django-upgrade==1.29.1
# via -r ./requirements.in
django-waffle==5.0.0
# via -r ./requirements.in
django-widget-tweaks==1.5.1
# via -r ./requirements.in
djangorestframework==3.16.1

View File

@@ -1,5 +1,6 @@
{% load static %}
{% load i18n %}
{% load waffle_tags %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
@@ -347,6 +348,9 @@
}"
class="h-screen bg-gray-200 dark:bg-black{% if DEBUG %} DEBUG{% endif %}" {% block body_id %}{% endblock %}>
<div class="modal-overlay" id="modalOverlay"><div class="modal-content"><iframe id="modalFrame" class="w-full h-full rounded-xl m-0 p-0"></iframe><div class="modal-close" id="modalClose" onclick="closeModal()"><i class="fa-solid fa-xmark fa-lg"></i></div></div></div>
{% flag "v3" %}
<div class="bg-slate text-white text-center py-2 font-semibold">v3 flag enabled</div>
{% endflag %}
{% block main_content_wrapper %}<div class="max-w-7xl md:px-3 mx-auto transition-all">{% endblock %}
{% block content_header %}
{% include "includes/_header.html" %}

View File

@@ -0,0 +1,24 @@
# Generated by Django 6.0.2 on 2026-02-17 15:12
from django.db import migrations
def create_v3_testers_group(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Group.objects.get_or_create(name="v3_testers")
def delete_v3_testers_group(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Group.objects.filter(name="v3_testers").delete()
class Migration(migrations.Migration):
dependencies = [
("users", "0020_rename_image_user_profile_image"),
]
operations = [
migrations.RunPython(create_v3_testers_group, delete_v3_testers_group),
]