Created
August 4, 2012 06:41
-
-
Save JonCooperWorks/3255178 to your computer and use it in GitHub Desktop.
Boolean to Yes/No filter
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
@evalcontextfilter | |
def boolval2yesno(eval_ctx, value, true="Yes", false="No"): | |
if value: | |
result = true | |
else: | |
result = false | |
if eval_ctx.autoescape: | |
result = Markup(result) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment