diff options
| author | Sjbrgsn <chsnot@gmail.com> | 2019-12-21 11:45:54 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-30 20:47:22 +0100 |
| commit | b2bd08bb7a912a1504f5fb5018f5317e6b5423cd (patch) | |
| tree | c481e9b848b285755f872554ed0b828e5256aee9 /django | |
| parent | cf5d4701dc12ad69d51042b0d7e81e4a54de4bd7 (diff) | |
Fixed #30892 -- Fixed slugify() and admin's URLify.js for "İ".
Thanks Luis Nell for the implementation idea and very detailed report.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/static/admin/js/urlify.js | 3 | ||||
| -rw-r--r-- | django/utils/text.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/admin/static/admin/js/urlify.js b/django/contrib/admin/static/admin/js/urlify.js index c3342b9d59..8a3842c9bc 100644 --- a/django/contrib/admin/static/admin/js/urlify.js +++ b/django/contrib/admin/static/admin/js/urlify.js @@ -177,6 +177,7 @@ var r = new RegExp('\\b(' + removeList.join('|') + ')\\b', 'gi'); s = s.replace(r, ''); } + s = s.toLowerCase(); // convert to lowercase // if downcode doesn't hit, the char will be stripped here if (allowUnicode) { // Keep Unicode letters including both lowercase and uppercase @@ -189,7 +190,7 @@ s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens s = s.substring(0, num_chars); // trim to first num_chars chars s = s.replace(/-+$/g, ''); // trim any trailing hyphens - return s.toLowerCase(); // convert to lowercase + return s; } window.URLify = URLify; })(); diff --git a/django/utils/text.py b/django/utils/text.py index 5e1409116e..110e088ddf 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -402,7 +402,7 @@ def slugify(value, allow_unicode=False): value = unicodedata.normalize('NFKC', value) else: value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii') - value = re.sub(r'[^\w\s-]', '', value).strip().lower() + value = re.sub(r'[^\w\s-]', '', value.lower()).strip() return re.sub(r'[-\s]+', '-', value) |
