Created
August 11, 2019 11:43
-
-
Save JustAyush/17dcb515acc68fc31fe592e1bd423ea0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import json | |
import operator | |
register = template.Library() | |
@register.filter | |
def lowerCase(value): | |
try: | |
value = value.replace("\'", "\"") | |
value = json.loads(value) | |
maxValue = max(value.items(), key=operator.itemgetter(1))[0] | |
except: | |
maxValue = value | |
return maxValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment