mirror of https://github.com/django/django.git
Fixed #299 -- Slugify no longer removes hyphens. Thanks, gch@cs.cmu.edu
git-svn-id: http://code.djangoproject.com/svn/django/trunk@464 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
151bf05850
commit
254f31819b
|
@ -54,15 +54,15 @@ def make_list(value, _):
|
||||||
|
|
||||||
def slugify(value, _):
|
def slugify(value, _):
|
||||||
"Converts to lowercase, removes non-alpha chars and converts spaces to hyphens"
|
"Converts to lowercase, removes non-alpha chars and converts spaces to hyphens"
|
||||||
value = re.sub('[^\w\s]', '', value).strip().lower()
|
value = re.sub('[^\w\s-]', '', value).strip().lower()
|
||||||
return re.sub('\s+', '-', value)
|
return re.sub('\s+', '-', value)
|
||||||
|
|
||||||
def stringformat(value, arg):
|
def stringformat(value, arg):
|
||||||
"""
|
"""
|
||||||
Formats the variable according to the argument, a string formatting specifier.
|
Formats the variable according to the argument, a string formatting specifier.
|
||||||
This specifier uses Python string formating syntax, with the exception that
|
This specifier uses Python string formating syntax, with the exception that
|
||||||
the leading "%" is dropped.
|
the leading "%" is dropped.
|
||||||
|
|
||||||
See http://docs.python.org/lib/typesseq-strings.html for documentation
|
See http://docs.python.org/lib/typesseq-strings.html for documentation
|
||||||
of Python string formatting
|
of Python string formatting
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue