CamelCase in Python / Django
Posted on October 30th, 2008 in App Engine, Programming | 2 Comments »
Here is a small script for making CamelCase string in python
import re
from string import capitalize
def camelcase(value):
return "".join([capitalize(w) for w in re.split(re.compile("[\W_]*"), value)])
in django just add
@register.filter
making it
import re
from string import capitalize
@register.filter
def camelcase(value):
return "".join([capitalize(w) for w in re.split(re.compile("[\W_]*"), value)])
Hope it help.
2 Responses
saved my day, thanks!
Thanks for this post. I am new at development and this was a big help.