mirror of
https://github.com/Hopiu/django-uuslug.git
synced 2026-03-16 20:10:24 +00:00
Drop PY2.7
This commit is contained in:
parent
afa51c6a2c
commit
ae6a0a61ae
11 changed files with 208 additions and 53 deletions
51
.github/workflows/ci.yml
vendored
Normal file
51
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
name: (CI)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- ci
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3]
|
||||
django-version: [2.2, 3.0, 3.1, 3.2, 4.0]
|
||||
exclude:
|
||||
# excludes list
|
||||
- python-version: 3.6
|
||||
django-version: 4.0
|
||||
- python-version: 3.7
|
||||
django-version: 4.0
|
||||
- python-version: pypy3
|
||||
django-version: 4.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
pip install coveralls
|
||||
pip install "django~=${{ matrix.django-version }}.0"
|
||||
- name: Run flake8
|
||||
run: |
|
||||
pip install flake8
|
||||
flake8 --exclude=migrations,tests --ignore=E501,E241,E225,E128 .
|
||||
- name: Run pycodestyle
|
||||
run: |
|
||||
pip install pycodestyle
|
||||
pycodestyle --exclude=migrations,tests --ignore=E501,E241,E225,E128 .
|
||||
- name: Run test
|
||||
run: |
|
||||
coverage run --source=ipware manage.py test
|
||||
- name: Coveralls
|
||||
run: coveralls --service=github
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
54
.github/workflows/dev.yml
vendored
Normal file
54
.github/workflows/dev.yml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
name: DEV
|
||||
|
||||
# Run on push only for dev/sandbox
|
||||
# Otherwise it may trigger concurrently `push & pull_request` on PRs.
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- sandbox
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3]
|
||||
django-version: [2.2, 3.0, 3.1, 3.2, 4.0]
|
||||
exclude:
|
||||
# excludes list
|
||||
- python-version: 3.6
|
||||
django-version: 4.0
|
||||
- python-version: 3.7
|
||||
django-version: 4.0
|
||||
- python-version: pypy3
|
||||
django-version: 4.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
pip install coveralls
|
||||
pip install "django~=${{ matrix.django-version }}.0"
|
||||
- name: Run flake8
|
||||
run: |
|
||||
pip install flake8
|
||||
flake8 --exclude=migrations,tests --ignore=E501,E241,E225,E128 .
|
||||
- name: Run pycodestyle
|
||||
run: |
|
||||
pip install pycodestyle
|
||||
pycodestyle --exclude=migrations,tests --ignore=E501,E241,E225,E128 .
|
||||
- name: Run test
|
||||
run: |
|
||||
coverage run --source=ipware manage.py test
|
||||
- name: Coveralls
|
||||
run: coveralls --service=github
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
52
.github/workflows/main.yml
vendored
Normal file
52
.github/workflows/main.yml
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
name: MAIN
|
||||
|
||||
# Run on push only for main
|
||||
# Otherwise it may trigger concurrently `push & pull_request` on PRs.
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3]
|
||||
django-version: [2.2, 3.0, 3.1, 3.2, 4.0]
|
||||
exclude:
|
||||
# excludes list
|
||||
- python-version: 3.6
|
||||
django-version: 4.0
|
||||
- python-version: 3.7
|
||||
django-version: 4.0
|
||||
- python-version: pypy3
|
||||
django-version: 4.0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
pip install coveralls
|
||||
pip install "django~=${{ matrix.django-version }}.0"
|
||||
- name: Run flake8
|
||||
run: |
|
||||
pip install flake8
|
||||
flake8 --exclude=migrations,tests --ignore=E501,E241,E225,E128 .
|
||||
- name: Run pycodestyle
|
||||
run: |
|
||||
pip install pycodestyle
|
||||
pycodestyle --exclude=migrations,tests --ignore=E501,E241,E225,E128 .
|
||||
- name: Run test
|
||||
run: |
|
||||
coverage run --source=ipware manage.py test
|
||||
- name: Coveralls
|
||||
run: coveralls --service=github
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
64
CHANGELOG.md
64
CHANGELOG.md
|
|
@ -1,105 +1,109 @@
|
|||
## 2.0.0
|
||||
|
||||
Maintenance:
|
||||
|
||||
- Up version python-slugify, remove support for old Django versions
|
||||
- Python 2.7 support dropped
|
||||
|
||||
## 1.2.0
|
||||
|
||||
Maintenance:
|
||||
|
||||
- Up version python-slugify, remove support for old Django versions
|
||||
|
||||
- Up version python-slugify, remove support for old Django versions
|
||||
|
||||
## 1.1.8
|
||||
|
||||
Maintenance:
|
||||
|
||||
- Up version python-slugify
|
||||
- Up version python-slugify
|
||||
|
||||
## 1.1.7
|
||||
|
||||
Enhancement:
|
||||
- Fix: False alarm on model/instance check. (@titusz)
|
||||
|
||||
- Fix: False alarm on model/instance check. (@titusz)
|
||||
|
||||
## 1.1.6
|
||||
|
||||
Maintenance:
|
||||
|
||||
- Up version python-slugify, fixed broken status links on github
|
||||
- Up version python-slugify, fixed broken status links on github
|
||||
|
||||
## 1.1.5
|
||||
|
||||
Enhancement:
|
||||
|
||||
- Ability to remove `stopwords` from string
|
||||
- Ability to auto truncate string to match model field's max_length
|
||||
- Ability to remove `stopwords` from string
|
||||
- Ability to auto truncate string to match model field's max_length
|
||||
|
||||
## 1.0.5
|
||||
|
||||
Fix:
|
||||
|
||||
- PyPI Cleanup
|
||||
- PyPI Cleanup
|
||||
|
||||
## 1.0.4
|
||||
|
||||
Enhancement:
|
||||
|
||||
- Added option to save word order
|
||||
- Added more tests
|
||||
- Added Django 1.8 and dropped unsupported Django
|
||||
- Added option to save word order
|
||||
- Added more tests
|
||||
- Added Django 1.8 and dropped unsupported Django
|
||||
|
||||
## 1.0.3
|
||||
|
||||
Enhancement:
|
||||
|
||||
- Support pypy
|
||||
- Support Django 1.7
|
||||
- More test cases
|
||||
- Update slugify
|
||||
- Support pypy
|
||||
- Support Django 1.7
|
||||
- More test cases
|
||||
- Update slugify
|
||||
|
||||
## 1.0.2
|
||||
|
||||
Enhancement:
|
||||
|
||||
- PEP8 Compliant
|
||||
- PEP8 Compliant
|
||||
|
||||
## 1.0.1
|
||||
|
||||
Enhancement:
|
||||
|
||||
- Added support for Django 1.6.1
|
||||
- Added support for Python 3.x
|
||||
- Added support for Django 1.6.1
|
||||
- Added support for Python 3.x
|
||||
|
||||
Misc:
|
||||
- Dropped support for Django<=1.4.10
|
||||
- Dropped support for Python 2.6
|
||||
|
||||
- Dropped support for Django<=1.4.10
|
||||
- Dropped support for Python 2.6
|
||||
|
||||
## 1.0.0
|
||||
|
||||
Enhancement:
|
||||
|
||||
- Support Django>=1.6
|
||||
|
||||
- Support Django>=1.6
|
||||
|
||||
## 0.2.0
|
||||
|
||||
Features:
|
||||
|
||||
- Added an option to choose a non-dash separator
|
||||
|
||||
- Added an option to choose a non-dash separator
|
||||
|
||||
## 0.1.0
|
||||
|
||||
Features:
|
||||
|
||||
- Added the ability to truncate slugs
|
||||
|
||||
- Added the ability to truncate slugs
|
||||
|
||||
## 0.0.9
|
||||
|
||||
Enhancement:
|
||||
|
||||
-- Removed buildout dependency
|
||||
-- Move Unicode Slug functionality into its own python-slugify module
|
||||
|
||||
-- Removed buildout dependency
|
||||
-- Move Unicode Slug functionality into its own python-slugify module
|
||||
|
||||
## 0.0.1
|
||||
|
||||
Features:
|
||||
|
||||
- Initial Release
|
||||
- Initial Release
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
Django>=1.8
|
||||
python-slugify>=1.2.1
|
||||
six>=1.13.0
|
||||
Django>=2.2.26
|
||||
python-slugify>=5.0.0
|
||||
|
|
|
|||
11
setup.py
11
setup.py
|
|
@ -14,20 +14,19 @@ url = 'https://github.com/un33k/django-uuslug'
|
|||
author = 'Val Neekman'
|
||||
author_email = 'info@neekware.com'
|
||||
license = 'BSD'
|
||||
install_requires = ['python-slugify>=1.2.0']
|
||||
install_requires = ['python-slugify>=5.0.0']
|
||||
classifiers = [
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Framework :: Django :: 1.11',
|
||||
'Framework :: Django :: 2.1',
|
||||
'Framework :: Django :: 2.2',
|
||||
'Intended Audience :: Developers',
|
||||
'Topic :: Software Development :: Build Tools',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Operating System :: POSIX',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ from .uuslug import * # noqa
|
|||
|
||||
__author__ = 'Val Neekman @ Neekware Inc. [@vneekman]'
|
||||
__description__ = 'A Python slugify application that also handles Unicode'
|
||||
__version__ = '1.2.0'
|
||||
__version__ = '2.0.0'
|
||||
|
||||
default_app_config = 'uuslug.apps.AppConfig'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from django.apps import AppConfig as DjangoAppConfig
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class AppConfig(DjangoAppConfig):
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ if 'testsettings' in os.environ['DJANGO_SETTINGS_MODULE']:
|
|||
self.slug = uuslug(self.name, instance=self, start_no=2, max_length=17, word_boundary=True)
|
||||
super(SmartTruncatedSlug, self).save(*args, **kwargs)
|
||||
|
||||
class SmartTruncatedExactWordBoundrySlug(models.Model):
|
||||
class SmartTruncatedExactWordBoundarySlug(models.Model):
|
||||
name = models.CharField(max_length=19)
|
||||
slug = models.CharField(max_length=19)
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ if 'testsettings' in os.environ['DJANGO_SETTINGS_MODULE']:
|
|||
|
||||
def save(self, *args, **kwargs):
|
||||
self.slug = uuslug(self.name, instance=self, start_no=9, max_length=19, word_boundary=True)
|
||||
super(SmartTruncatedExactWordBoundrySlug, self).save(*args, **kwargs)
|
||||
super(SmartTruncatedExactWordBoundarySlug, self).save(*args, **kwargs)
|
||||
|
||||
class CoolSlugDifferentSeparator(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.test import TestCase
|
|||
|
||||
from uuslug import slugify, uuslug
|
||||
from uuslug.models import (CoolSlug, AnotherSlug, TruncatedSlug,
|
||||
SmartTruncatedExactWordBoundrySlug,
|
||||
SmartTruncatedExactWordBoundarySlug,
|
||||
CoolSlugDifferentSeparator, TruncatedSlugDifferentSeparator,
|
||||
AutoTruncatedSlug)
|
||||
|
||||
|
|
@ -186,16 +186,16 @@ class SlugUniqueTestCase(TestCase):
|
|||
obj = TruncatedSlug.objects.create(name=name)
|
||||
self.assertEqual(obj.slug, "jaja-lol-mememe-3") # 17 is max_length
|
||||
|
||||
def test_max_length_exact_word_boundry(self):
|
||||
def test_max_length_exact_word_boundary(self):
|
||||
name = 'jaja---lol-méméméoo--a'
|
||||
|
||||
obj = SmartTruncatedExactWordBoundrySlug.objects.create(name=name)
|
||||
obj = SmartTruncatedExactWordBoundarySlug.objects.create(name=name)
|
||||
self.assertEqual(obj.slug, "jaja-lol-mememeoo-a") # 19 is max_length
|
||||
|
||||
obj = SmartTruncatedExactWordBoundrySlug.objects.create(name=name)
|
||||
obj = SmartTruncatedExactWordBoundarySlug.objects.create(name=name)
|
||||
self.assertEqual(obj.slug, "jaja-lol-mememeoo-9") # 19 is max_length, start_no = 9
|
||||
|
||||
obj = SmartTruncatedExactWordBoundrySlug.objects.create(name=name)
|
||||
obj = SmartTruncatedExactWordBoundarySlug.objects.create(name=name)
|
||||
self.assertEqual(obj.slug, "jaja-lol-mememeo-10") # 19 is max_length, readjust for "-10"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
from django.db.models.base import ModelBase
|
||||
from slugify import slugify as pyslugify
|
||||
import six
|
||||
if six.PY3:
|
||||
from django.utils.encoding import smart_str
|
||||
else:
|
||||
from django.utils.encoding import smart_unicode as smart_str
|
||||
from django.utils.encoding import smart_str
|
||||
|
||||
__all__ = ['slugify', 'uuslug']
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue