resources
demoforms/settings.pyINSTALLED_APPS = (
...
'waffle',
)
from django.views.generic import FormView
from django.shortcuts import render_to_response
from django.template import RequestContext
from waffle.decorators import waffle_flag, flag_is_active
from main.forms import CreditCardForm
class MainView(FormView):
template_name = 'main/index.html'
form_class = CreditCardForm
def get_context_data(self, kwargs):
context = super(MainView, self).get_context_data(kwargs)
if flag_is_active(self.request, 'information'):
context['data'] = 'Flag is active'
else:
context['data'] = 'Flag is inactive'
return context
@waffle_flag('information')
def info(request):
template_name = 'main/information.html'
return render_to_response(template_name,
{},
context_instance=RequestContext(request))