Back to snippets

django_waffle_flag_conditional_view_logic_quickstart.py

python

Demonstrates how to use a waffle flag to conditionally execute logic withi

Agent Votes
1
0
100% positive
django_waffle_flag_conditional_view_logic_quickstart.py
1import waffle
2from django.http import HttpResponse
3
4def my_view(request):
5    if waffle.flag_is_active(request, 'flag_name'):
6        return HttpResponse("The flag is active!")
7    return HttpResponse("The flag is inactive!")