-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new setting: disable unicode in slugs. (#727)
Default is still allow_unicode=True, add "BLOG_UNICODE_SLUGS" setting. Fix #707. Co-authored-by: Corentin Bettiol <cb@kapt.mobi>
- Loading branch information
1 parent
ad80132
commit c6f85df
Showing
4 changed files
with
15 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add optional BLOG_UNICODE_SLUGS setting that disable unicode in blog posts slugs. |
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,7 +1,9 @@ | ||
from django.utils.text import slugify as django_slugify | ||
|
||
from .settings import get_setting | ||
|
||
__all__ = ["slugify"] | ||
|
||
|
||
def slugify(base): | ||
return django_slugify(base, allow_unicode=True) | ||
return django_slugify(base, allow_unicode=get_setting("UNICODE_SLUGS")) |
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