mirror of
https://github.com/Hopiu/django-uuslug.git
synced 2026-03-16 20:10:24 +00:00
change to smart_str for py3
This commit is contained in:
parent
240d89c62a
commit
bc62fa2144
1 changed files with 8 additions and 2 deletions
|
|
@ -2,7 +2,13 @@
|
|||
|
||||
__version__ = '1.0.2'
|
||||
|
||||
from django.utils.encoding import smart_unicode
|
||||
from django.utils import six
|
||||
|
||||
if six.PY3:
|
||||
from django.utils.encoding import smart_unicode as smart_str
|
||||
else:
|
||||
from django.utils.encoding import smart_str
|
||||
|
||||
from slugify import slugify as pyslugify
|
||||
|
||||
__all__ = ['slugify', 'uuslug']
|
||||
|
|
@ -11,7 +17,7 @@ __all__ = ['slugify', 'uuslug']
|
|||
def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, word_boundary=False, separator='-'):
|
||||
""" Make a slug from a given text """
|
||||
|
||||
return smart_unicode(pyslugify(text, entities, decimal, hexadecimal, max_length, word_boundary, separator))
|
||||
return smart_str(pyslugify(text, entities, decimal, hexadecimal, max_length, word_boundary, separator))
|
||||
|
||||
|
||||
def uuslug(s, instance, entities=True, decimal=True, hexadecimal=True,
|
||||
|
|
|
|||
Loading…
Reference in a new issue