diff options
| author | Edward Henderson <kutenai@me.com> | 2015-04-15 16:28:49 -0600 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-07-17 13:48:58 -0400 |
| commit | f8cc464452f495fce2a3d6f7494396c8f798a1e6 (patch) | |
| tree | 61049a8351e327b59c98341f98dacda0e8186be2 /docs/ref/utils.txt | |
| parent | adffff79a36f7de30f438915c492e475e17025f6 (diff) | |
Fixed #16501 -- Added an allow_unicode parameter to SlugField.
Thanks Flavio Curella and Berker Peksag for the initial patch.
Diffstat (limited to 'docs/ref/utils.txt')
| -rw-r--r-- | docs/ref/utils.txt | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 7912edd5ce..d053dee8df 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -836,11 +836,11 @@ appropriate entities. .. module:: django.utils.text :synopsis: Text manipulation. -.. function:: slugify +.. function:: slugify(allow_unicode=False) - Converts to ASCII. Converts spaces to hyphens. Removes characters that - aren't alphanumerics, underscores, or hyphens. Converts to lowercase. Also - strips leading and trailing whitespace. + Converts to ASCII if ``allow_unicode`` is ``False`` (default). Converts spaces to + hyphens. Removes characters that aren't alphanumerics, underscores, or + hyphens. Converts to lowercase. Also strips leading and trailing whitespace. For example:: @@ -849,6 +849,17 @@ appropriate entities. If ``value`` is ``"Joel is a slug"``, the output will be ``"joel-is-a-slug"``. + You can set the ``allow_unicode`` parameter to ``True``, if you want to + allow Unicode characters:: + + slugify(value, allow_unicode=True) + + If ``value`` is ``"你好 World"``, the output will be ``"你好-world"``. + + .. versionchanged:: 1.9 + + The ``allow_unicode`` parameter was added. + .. _time-zone-selection-functions: ``django.utils.timezone`` |
