diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9f2e76..4145f0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,26 +74,3 @@ jobs: - name: Run tests run: python setup.py test - run: codecov - - extras: - needs: - - readme - - lint - runs-on: ubuntu-latest - strategy: - matrix: - extras: - - slugify - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip setuptools wheel codecov - python -m pip install -e .[${{ matrix.extras }}] - - name: Run tests - run: python setup.py test - - run: codecov diff --git a/README.rst b/README.rst index 738798e..53beb96 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ Installation .. code-block:: bash - pip install django-dynamic-filenames[slugify] + pip install django-dynamic-filenames Samples ~~~~~~~ diff --git a/dynamic_filenames.py b/dynamic_filenames.py index ca4246b..3ba9feb 100644 --- a/dynamic_filenames.py +++ b/dynamic_filenames.py @@ -3,17 +3,7 @@ import re import uuid from string import Formatter - - -def slugify(value): - try: # use unicode-slugify library if installed - from slugify import slugify as _slugify - - return _slugify(value, only_ascii=True) - except ImportError: - from django.utils.text import slugify as _slugify - - return _slugify(value, allow_unicode=False) +from django.utils.text import slugify class SlugFormatter(Formatter): @@ -24,7 +14,7 @@ def format_field(self, value, format_spec): if precision: precision = int(precision.lstrip(".")) if ftype == "slug": - return slugify(value)[:precision] + return slugify(value, allow_unicode=False)[:precision] return super().format_field(value=value, format_spec=format_spec) diff --git a/setup.cfg b/setup.cfg index 87807a5..cf34d7f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,6 @@ tests_require = [options.extras_require] slugify = - unicode-slugify [aliases] test = pytest