File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,51 @@ Samples
67
67
{% endsample %}
68
68
69
69
70
+ Django Template Filters and Tags
71
+ ================================
72
+ Django Waffle provides three new Django Template tags and filters, ``flag_is_active ``,
73
+ ``switch_is_active ``, and ``sample_is_active ``. Each of these tags and filters can be used in Django
74
+ template's if statement contitions to check if a flag, switch, or sample is active.
75
+
76
+ This is useful for when a django template context variable and a flag, switch, or sample are required to
77
+ be active in order to render a certain part of the template.
78
+
79
+ flag_is_active
80
+ --------------
81
+
82
+ ::
83
+
84
+ {% flag_is_active "flag" request True as is_flag_active %}
85
+ {% if is_flag_active %}
86
+ flag_is_active on
87
+ {% else %}
88
+ flag_is_active off
89
+ {% endif %}
90
+
91
+ switch_is_active
92
+ ----------------
93
+
94
+ ::
95
+
96
+ {% if "switch"|switch_is_active %}
97
+ switch_is_active on
98
+ {% else %}
99
+ switch_is_active off
100
+ {% endif %}
101
+
102
+ sample_is_active
103
+ ----------------
104
+
105
+ ::
106
+
107
+ {% if "sample"|sample_is_active %}
108
+ sample_is_active on
109
+ {% else %}
110
+ sample_is_active off
111
+ {% endif %}
112
+
113
+
114
+
70
115
.. _templates-jinja :
71
116
72
117
Jinja Templates
You can’t perform that action at this time.
0 commit comments