This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
forked from jazzband/django-waffle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Socol
committed
Apr 13, 2011
1 parent
8d450e0
commit aabfa34
Showing
4 changed files
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{% if waffle_flag('flag') %} | ||
{% if waffle.flag('flag') %} | ||
flag on | ||
{% else %} | ||
flag off | ||
{% endif %} | ||
|
||
{% if waffle_switch('switch') %} | ||
{% if waffle.switch('switch') %} | ||
switch on | ||
{% else %} | ||
switch off | ||
{% endif %} | ||
|
||
{% if waffle.sample('sample') %} | ||
sample on | ||
{% else %} | ||
sample off | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
from jingo import register | ||
import jingo | ||
import jinja2 | ||
|
||
from waffle import flag_is_active, sample_is_active, switch_is_active | ||
|
||
|
||
@register.function | ||
@jinja2.contextfunction | ||
def waffle_flag(context, flag_name): | ||
def flag_helper(context, flag_name): | ||
return flag_is_active(context['request'], flag_name) | ||
|
||
|
||
@register.function | ||
def waffle_switch(switch_name): | ||
return switch_is_active(switch_name) | ||
|
||
|
||
@register.function | ||
def waffle_sample(sample_name): | ||
return sample_is_active(sample_name) | ||
jingo.env.globals['waffle'] = { | ||
'flag': flag_helper, | ||
'switch': switch_is_active, | ||
'sample': sample_is_active, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters