Skip to content

Conversation

@stevejalim
Copy link
Contributor

@stevejalim stevejalim commented Jan 16, 2026

This changeset adds support for django-waffle switches to our page() view helper. Previously, one had to rewrite the route as regular Django view in order to use the switch to show/hide the route

Summary

  • Add optional enabling_switch parameter to the page() helper function
  • When specified, the page returns 404 if the waffle switch is disabled
  • Allows feature-flagged pages to be easily controlled via waffle switches

Usage

page("new-feature/", "mozorg/new-feature.html", enabling_switch="new-feature")

Test plan

  • Added unit tests for switch ON (renders), switch OFF (404), and no switch (renders normally)
  • Manual verification: create a test page with enabling_switch, verify 404 when switch is OFF and 200 when ON

Fixes #16992

Add optional waffle switch support to the page() helper function.
When an enabling_switch is specified, the page returns 404 if the
switch is disabled, allowing feature-flagged pages to be easily
controlled via waffle switches.

Fixes #16992
@stevejalim stevejalim requested a review from a team as a code owner January 16, 2026 11:12
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.09%. Comparing base (a96ae66) to head (7a89ae0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16993   +/-   ##
=======================================
  Coverage   81.08%   81.09%           
=======================================
  Files         157      157           
  Lines        8313     8317    +4     
=======================================
+ Hits         6741     6745    +4     
  Misses       1572     1572           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stevejalim stevejalim changed the title Add enabling_switch parameter to page() helper Support Switches with page() decorator Jan 16, 2026
@stevejalim stevejalim changed the title Support Switches with page() decorator Support Switches with page() helper Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support waffle switches in our page() helper

2 participants