Created
August 30, 2017 08:00
-
-
Save umutcoskun/c825a44004fbf4c3a66452910ca8f9ee to your computer and use it in GitHub Desktop.
Django custom template filter to hashing value.
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
from django import template | |
register = template.Library() | |
@register.filter(name='md5') | |
def md5(value): | |
""" | |
Usage: | |
{{ user.email|md5 }} | |
""" | |
import hashlib | |
return hashlib.md5(value).hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment