Skip to content

Commit 327d186

Browse files
authored
Add support for Django 5.0 (#540)
* Add support for Django 5.0 * Fix up .github/workflow YAML typo * Add missing `setuptools` requirement for 3.12 environments * Fix GA workflow matrix to exclude unsupported environments
1 parent a7df85e commit 327d186

File tree

5 files changed

+57
-8
lines changed

5 files changed

+57
-8
lines changed

.github/workflows/workflow.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,28 @@ jobs:
3333
python-version:
3434
- 3.8
3535
- 3.9
36+
- "3.10"
37+
- "3.11"
38+
- "3.12"
3639
django:
3740
- 3.2
3841
- 4.0
42+
- 4.1
43+
- 4.2
44+
- 5.0
3945
database:
4046
- sqlite
4147
- mysql
4248
- postgres
49+
exclude:
50+
- python-version: 3.8
51+
django: 5.0
52+
- python-version: 3.9
53+
django: 5.0
54+
- python-version: "3.11"
55+
django: 3.2
56+
- python-version: "3.12"
57+
django: 3.2
4358

4459
# additional service containers to run
4560
services:
@@ -94,14 +109,23 @@ jobs:
94109

95110
# install environment specific dependencies
96111
- name: Install coverage
97-
run: pip install coverage>=5.3
112+
run: pip install coverage>=5.3 setuptools
98113

99114
- name: Install Django 3.2
100115
if: matrix.django == 3.2
101116
run: pip install "Django>=3.2,<4.0"
102117
- name: Install Django 4.0
103118
if: matrix.django == 4.0
104119
run: pip install "Django>=4.0,<4.1"
120+
- name: Install Django 4.1
121+
if: matrix.django == 4.1
122+
run: pip install "Django>=4.1,<4.2"
123+
- name: Install Django 4.2
124+
if: matrix.django == 4.2
125+
run: pip install "Django>=4.2,<5.0"
126+
- name: Install Django 5.0
127+
if: matrix.django == 5.0
128+
run: pip install "Django>=5.0,<5.1"
105129
- name: Install MySQL libs
106130
if: matrix.database == 'mysql'
107131
run: pip install mysqlclient>=2.0.1 django-mysql>=3.9.0

actstream/actions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ def action_handler(verb, **kwargs):
111111

112112
# We must store the untranslated string
113113
# If verb is an ugettext_lazyed string, fetch the original string
114+
# _proxy____args is a valid attribute in Django <= 4.2
114115
if hasattr(verb, '_proxy____args'):
115116
verb = verb._proxy____args[0]
117+
# _args is the new attribute in Django >= 5.0
118+
if hasattr(verb, '_args'):
119+
verb = verb._args[0]
116120

117121
newaction = apps.get_model('actstream', 'action')(
118122
actor_content_type=ContentType.objects.get_for_model(actor),

docs/changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Changelog
44
=========
55

6+
2.0.1
7+
-----
8+
9+
- Adds support for Django 5.0
10+
611
2.0.0
712
-----
813

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Make sure to pick the version of Django and django-activity-stream that supports
6060
Python
6161
******
6262

63-
* **Python 3**: 3.6 to 3.9
63+
* **Python 3**: 3.6 to 3.12
6464
* **PyPy**: 3
6565

6666
Django

tox.ini

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
[tox]
22
envlist =
3-
py{37,38,39}-django32-{mysql,postgres,sqlite}
4-
py{38,39}-django40-{mysql,postgres,sqlite}
5-
py{38,39}-django41-{mysql,postgres,sqlite}
3+
py{37,38,39,310}-django32-{mysql,postgres,sqlite}
4+
py{38,39,310}-django40-{mysql,postgres,sqlite}
5+
py{38,39,310,311}-django41-{mysql,postgres,sqlite}
6+
py{38,39,310,311,312}-django42-{mysql,postgres,sqlite}
7+
py{310,311,312}-django50-{mysql,postgres,sqlite}
68
toxworkdir=/tmp/.tox
79

810
[testenv]
9-
commands = pytest -s --cov --cov-append actstream/ runtests/testapp runtests/testapp_nested/
11+
commands = python -m pytest -s --cov --cov-append actstream/ runtests/testapp runtests/testapp_nested/
1012

1113
deps =
1214
django-rest-framework
@@ -16,10 +18,13 @@ deps =
1618
pytest
1719
pytest-cov
1820
pytest-django
21+
setuptools
1922
coverage>=4.5.1
2023
django32: Django>=3.2,<4.0
2124
django40: Django>=4.0,<4.1
2225
django41: Django>=4.1,<4.2
26+
django42: Django>=4.2,<5.0
27+
django50: Django>=5.0,<5.1
2328
mysql: mysqlclient>=2.0.0
2429
mysql: django-mysql>=2.4.1
2530
postgres: psycopg2-binary>=2.8
@@ -30,7 +35,19 @@ setenv =
3035
postgres: DATABASE_ENGINE=postgresql
3136

3237
; Pass this to force enable mysql/postgres dbs
33-
passenv = GITHUB_WORKFLOW MYSQL_HOST MYSQL_NAME MYSQL_USER MYSQL_PASSWORD MYSQL_PORT POSTGRES_HOST POSTGRES_NAME POSTGRES_PORT POSTGRES_USER POSTGRES_PASSWORD SQLITE_NAME
38+
passenv =
39+
GITHUB_WORKFLOW
40+
MYSQL_HOST
41+
MYSQL_NAME
42+
MYSQL_USER
43+
MYSQL_PASSWORD
44+
MYSQL_PORT
45+
POSTGRES_HOST
46+
POSTGRES_NAME
47+
POSTGRES_PORT
48+
POSTGRES_USER
49+
POSTGRES_PASSWORD
50+
SQLITE_NAME
3451

3552
usedevelop = True
3653

@@ -53,4 +70,3 @@ DATABASE =
5370
mysql: mysql
5471
postgresql: postgresql
5572
sqlite: sqlite
56-

0 commit comments

Comments
 (0)