-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove dependency on unicode-slugify, use Django builtin function
- Loading branch information
1 parent
2497ce1
commit 347b842
Showing
5 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from django.test import TestCase | ||
|
||
from ..utils import slugify | ||
|
||
|
||
class TestSlugify(TestCase): | ||
def test_slugify(self): | ||
string_dict = { | ||
"naïve café": "naïve-café", | ||
"spaced out": "spaced-out", | ||
"[email protected]": "userdomaincom", | ||
"100% natural": "100-natural", | ||
"über-cool": "über-cool", | ||
"façade élégant": "façade-élégant", | ||
"北京大学": "北京大学", | ||
"Толстой": "толстой", | ||
"ñoño": "ñoño", | ||
"سلام": "سلام", | ||
"Αθήνα": "Αθήνα", | ||
"こんにちは": "こんにちは", | ||
"˚č$'\\*>%ˇ'!/": "čˇ", | ||
} | ||
for key, value in string_dict.items(): | ||
self.assertEqual(slugify(key), value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"""This module contains utility functions that are used across the project.""" | ||
|
||
from django.utils.text import slugify as django_slugify | ||
|
||
|
||
def slugify(text): | ||
"""Slugify a string. This function is a wrapper to unify the slugify function across the project.""" | ||
return django_slugify(text, allow_unicode=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
django-mptt | ||
unicode-slugify |