Skip to content

Commit

Permalink
Merge pull request #140 from ckarli/master
Browse files Browse the repository at this point in the history
Add Django 5.0 And Python 3.12 Compatibility
  • Loading branch information
jerch authored Jan 19, 2024
2 parents 1d1929e + bf1e289 commit f1443fc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 24 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ on:

jobs:

django_32:
django_42:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "Django~=3.2"
pip install "Django~=4.2"
pip install -r example/requirements-ci.txt
- name: Setup DB
run: |
Expand All @@ -50,12 +50,12 @@ jobs:
parallel: true
flag-name: Unit Test

django_42:
django_5:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "Django~=4.2"
pip install "Django~=5.0"
pip install -r example/requirements-ci.txt
- name: Setup DB
run: |
Expand All @@ -88,13 +88,13 @@ jobs:
with:
parallel: true
flag-name: Unit Test

mysql:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
services:
mysql:
image: mysql:latest
Expand All @@ -112,7 +112,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "Django~=4.2"
pip install "Django~=5.0"
pip install -r example/requirements-ci.txt
- name: Setup DB
run: |
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
services:
mysql:
image: postgres:latest
Expand All @@ -160,7 +160,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "Django~=4.2"
pip install "Django~=5.0"
pip install -r example/requirements-ci.txt
- name: Setup DB
run: |
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
services:
mysql:
image: postgres:latest
Expand All @@ -208,7 +208,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "Django~=4.2"
pip install "Django~=5.0"
pip install -r example/requirements-ci-psycopg3.txt
- name: Setup DB
run: |
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
services:
mysql:
image: mariadb:latest
Expand All @@ -257,7 +257,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "Django~=4.2"
pip install "Django~=5.0"
pip install -r example/requirements-ci.txt
- name: Setup DB
run: |
Expand All @@ -284,7 +284,7 @@ jobs:
flag-name: Unit Test

coveralls_finish:
needs: [django_32, django_42, mysql, postgres, postgres-psycopg3, mariadb]
needs: [django_42, django_5, mysql, postgres, postgres-psycopg3, mariadb]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
Expand Down
2 changes: 2 additions & 0 deletions example/exampleapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Foo(ComputedFieldsModel):
depends=[('bar_set.baz_set', ['name'])]
)
def bazzes(self) -> str:
if not self.pk:
return ''
# note - the slice here is needed to get proper compare between
# loop and bulk/fast mode in updatedata
# background: bulk_update and fast_update do not raise on values not
Expand Down
8 changes: 6 additions & 2 deletions example/test_full/tests/test02_fkback.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ def setUp(self):
# multi fk back steps deps to non comp field
'C': {'depends': [('self', ['name']), ('cd_f.de_f', ['name'])],
'func': lambda self: self.name + ''.join(
MODELS['E'].objects.filter(f_ed__f_dc=self).values_list('name', flat=True).order_by('pk'))},
MODELS['E'].objects.filter(f_ed__f_dc=self).values_list('name', flat=True).order_by('pk'))
if self.pk
else ''},
# multi fk back steps deps to comp field
'D': {'depends': [('self', ['name']), ('de_f.ef_f.fg_f', ['comp'])],
'func': lambda self: self.name + ''.join(
MODELS['G'].objects.filter(f_gf__f_fe__f_ed=self).values_list('comp', flat=True).order_by('pk'))},
MODELS['G'].objects.filter(f_gf__f_fe__f_ed=self).values_list('comp', flat=True).order_by('pk'))
if self.pk
else ''},
})
self.a = self.models.A(name='a')
self.a.save()
Expand Down
8 changes: 6 additions & 2 deletions example/test_full/tests/test08_o2oback.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ def setUp(self):
# multi o2o back steps deps to non comp field
'C': {'depends': [('self', ['name']), ('cd_o.de_o', ['name'])],
'func': lambda self: self.name + ''.join(
MODELS['E'].objects.filter(o_ed__o_dc=self).values_list('name', flat=True).order_by('pk'))},
MODELS['E'].objects.filter(o_ed__o_dc=self).values_list('name', flat=True).order_by('pk'))
if self.pk
else ''},
# multi o2o back steps deps to comp field
'D': {'depends': [('self', ['name']), ('de_o.ef_o.fg_o', ['comp'])],
'func': lambda self: self.name + ''.join(
MODELS['G'].objects.filter(o_gf__o_fe__o_ed=self).values_list('comp', flat=True).order_by('pk'))},
MODELS['G'].objects.filter(o_gf__o_fe__o_ed=self).values_list('comp', flat=True).order_by('pk'))
if self.pk
else ''},
})
self.a = self.models.A(name='a')
self.a.save()
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_version(path):
packages=find_packages(exclude=['example']),
include_package_data=True,
install_requires=[
'Django>=2.2,<5.0',
'Django>=2.2,<5.1',
'typing_extensions>=4.1',
'django-fast-update'
],
Expand All @@ -42,12 +42,12 @@ def get_version(path):
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'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.11',
'Programming Language :: Python :: 3.12'
],
)

0 comments on commit f1443fc

Please sign in to comment.