Open
Description
In my usage of Django-waffle, I found that I cannot use the switch template tag within an if statement's condition in Django templates as some blocks of code require both the switch to be active and another context variable to be set.
Please find an example of this case below:
{% switch 'switch'%}
{% if context_variable %}
modified message
{% else %}
default message
{% endif %}
{% else %}
default
{%endswitch%}
Suggestion: I suggest we make template filters for switch_is_active
, flag_is_active
, and sample_is_active
, this will allow the reduction of redundant code in this scenario.
an example of this suggestion is below:
{% if 'switch'|switch_is_active and context_variable%}
modified message
{% else %}
default message
{% endif %}
If this is a good suggestion, I can make a PR for it.
Metadata
Metadata
Assignees
Labels
No labels
Activity