graphene-django/graphene_django/utils/str_converters.py
Jean-Louis Fuchs 08d0cce55a
Move to_const function from Graphene into Graphene-Django (#992) (#996)
Co-authored-by: Jonathan Kim <jkimbo@gmail.com>
2020-06-27 10:43:25 +01:00

7 lines
128 B
Python

import re
from unidecode import unidecode
def to_const(string):
return re.sub(r"[\W|^]+", "_", unidecode(string)).upper()