> slugify Converts to lowercase, removes non-word characters
(alphanumerics and underscores) and converts spaces to hyphens. Also
strips leading and trailing whitespace.
In Python 3:
{{{
>>> 'вася'.isalnum()
>>> True
}}}
but slugify doesn't work like documented for such strings. Isn't it a bug
if something doesn't work as documented?
https://code.djangoproject.com/ticket/8391 was closed as wontfix. If there
is no intention to make slugify work better it should be documented when
it works and when people should find alternative solutions.
--
Ticket URL: <https://code.djangoproject.com/ticket/23558>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: mmitar@… (added)
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:1>
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
`s/alphanumerics/ASCII alphanumerics/` should do the job :-)
More seriously, let's take this opportunity to expand a bit the
documentation and point to [https://github.com/mozilla/unicode-slugify/
unicode-slugify] -- which produces unicode slugs, while django produces
ASCII slugs.
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:2>
Comment (by mitar):
You can also point to [https://github.com/mitar/django-
missing/blob/master/missing/templatetags/url_tags.py#L179 slugify2]. ;-)
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:3>
* status: new => assigned
* owner: nobody => dhoffman
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:4>
* has_patch: 0 => 1
Comment:
Pull request: https://github.com/django/django/pull/3349
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:5>
Comment (by dhoffman):
I created a new pull request based on the feedback to my previous one:
https://github.com/django/django/pull/3357
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:6>
Comment (by SmileyChris):
The problem is, it's not *just* ASCII alphanumerics kept either so the
suggested description is still incorrect:
{{{
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.utils.text import slugify
>>> slugify('Māori')
'maori'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:7>
Comment (by dhoffman):
Ah, good point.
I have updated with another pull request:
https://github.com/django/django/pull/3358
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"03467368dbd6a427985f86463faa61619f08c833"]:
{{{
#!CommitTicketReference repository=""
revision="03467368dbd6a427985f86463faa61619f08c833"
Fixed #23558 -- documented slugify limitations
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"d9bb7128fe7bc565a2dbbd1e89bb0345711b46f6"]:
{{{
#!CommitTicketReference repository=""
revision="d9bb7128fe7bc565a2dbbd1e89bb0345711b46f6"
[1.7.x] Fixed #23558 -- documented slugify limitations
Backport of 03467368db from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:10>
Comment (by Haakenlid):
Is this the new documentation?
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.
Where can I find out which alphanumerics are deleted, and which
alphanumerics are converted to ASCII?
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:11>
Comment (by Ülgen Sarıkavak):
Documentation is still misleading, why this issue is closed?
--
Ticket URL: <https://code.djangoproject.com/ticket/23558#comment:12>