Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Ben Makhlouf committed Mar 13, 2024
2 parents f0a5069 + 3fda1da commit 31cd30e
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
django-version: ['2.2', '3.0', '3.1', '3.2', '4.0', 'main']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version: ['3.2', '4.0', '4.1', '4.2', '5.0', 'main']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -26,7 +26,7 @@ jobs:
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
Expand All @@ -37,6 +37,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
Expand All @@ -46,6 +47,6 @@ jobs:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
name: Python ${{ matrix.python-version }}
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repos: []
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ cache: pip
install: travis_retry pip install coveralls tox tox-travis
script: tox -v
python:
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
- 3.12
after_script:
- coveralls
jobs:
fast_finish: true
include:
- stage: deploy
env:
python: 3.7
python: 3.8
script: skip
deploy:
provider: pypi
Expand Down
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ Changes
(unreleased)
------------------


1.7.0 (2024-03-13)
------------------

- Dropped support for Python 3.6 and 3.7! [medbenmakhlouf]
- Dropped support for Django 2.2, 3.0 and 3.1! [medbenmakhlouf]
- Add support for Python 3.10, 3.11 and 3.12. [medbenmakhlouf]
- Add Support for Django 4.1, 4.2 and 5.0! [medbenmakhlouf]


1.6.0 (2022-07-13)
------------------

Expand Down
9 changes: 4 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
-e .
pytest==4.6.8
pytest-cov==2.8.1
pytest-django==3.7.0
pytest-pythonpath==0.7.3
pytest==7.4.4
pytest-cov==2.10.0
pytest-django==4.6.0
pytest-sugar==0.9.2
recommonmark==0.6.0
sphinx_rtd_theme==0.4.3
sphinx-rtd-theme==2.0.0
15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
url="https://github.com/jazzband/django-smart-selects",
packages=find_packages(),
include_package_data=True,
python_requires=">=3.6",
install_requires=["django>=2.2"],
python_requires=">=3.8",
install_requires=["django>=3.2"],
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
],
)
9 changes: 3 additions & 6 deletions smart_selects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from pkg_resources import get_distribution, DistributionNotFound
from importlib.metadata import version

__version__ = version("django-smart-selects")

try:
__version__ = get_distribution("django-smart-selects").version
except DistributionNotFound:
# package is not installed
__version__ = None
11 changes: 9 additions & 2 deletions smart_selects/form_fields.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django
from django.apps import apps
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from django.forms import ChoiceField
Expand Down Expand Up @@ -59,7 +60,10 @@ def _get_choices(self):
choices = super(ChainedModelChoiceField, self)._get_choices()
return choices

choices = property(_get_choices, ChoiceField._set_choices)
if django.VERSION >= (5, 0):
choices = property(_get_choices, ChoiceField.choices)
else:
choices = property(_get_choices, ChoiceField._set_choices)


class ChainedManyToManyField(ModelMultipleChoiceField):
Expand Down Expand Up @@ -143,4 +147,7 @@ def _get_choices(self):
def make_choice(self, obj):
return (obj.pk, " " + self.label_from_instance(obj))

choices = property(_get_choices, ChoiceField._set_choices)
if django.VERSION >= (5, 0):
choices = property(_get_choices, ChoiceField.choices)
else:
choices = property(_get_choices, ChoiceField._set_choices)
22 changes: 12 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
[tox]
envlist =
py{36,37,38,39}-dj{22,30,31,32}
py{38,39,310}-dj{40,main}
py{38,39,310}-dj{32,40}
py{38,39,310,311}-dj{41}
py{38,39,310,311,312}-dj{42}
py{310,311,312}-dj{50,main}
flake8

[testenv]
usedevelop = True
ignore_outcome =
djmain: True
deps =
dj22: django>=2.2,<3.0
dj30: django>=3.0,<3.1
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<4.0
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
djmain: https://github.com/django/django/archive/main.tar.gz
coverage
commands =
Expand All @@ -30,17 +32,17 @@ commands =

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38, flake8
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DJANGO =
2.2: dj22
3.0: dj30
3.1: dj31
3.2: dj32
4.0: dj40
4.1: dj41
4.2: dj42
5.0: dj50
main: djmain

0 comments on commit 31cd30e

Please sign in to comment.