Skip to content

Commit

Permalink
Add support for Django 5.0 (#540)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wgordon17 authored Aug 19, 2024
1 parent a7df85e commit 327d186
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 8 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,28 @@ jobs:
python-version:
- 3.8
- 3.9
- "3.10"
- "3.11"
- "3.12"
django:
- 3.2
- 4.0
- 4.1
- 4.2
- 5.0
database:
- sqlite
- mysql
- postgres
exclude:
- python-version: 3.8
django: 5.0
- python-version: 3.9
django: 5.0
- python-version: "3.11"
django: 3.2
- python-version: "3.12"
django: 3.2

# additional service containers to run
services:
Expand Down Expand Up @@ -94,14 +109,23 @@ jobs:

# install environment specific dependencies
- name: Install coverage
run: pip install coverage>=5.3
run: pip install coverage>=5.3 setuptools

- name: Install Django 3.2
if: matrix.django == 3.2
run: pip install "Django>=3.2,<4.0"
- name: Install Django 4.0
if: matrix.django == 4.0
run: pip install "Django>=4.0,<4.1"
- name: Install Django 4.1
if: matrix.django == 4.1
run: pip install "Django>=4.1,<4.2"
- name: Install Django 4.2
if: matrix.django == 4.2
run: pip install "Django>=4.2,<5.0"
- name: Install Django 5.0
if: matrix.django == 5.0
run: pip install "Django>=5.0,<5.1"
- name: Install MySQL libs
if: matrix.database == 'mysql'
run: pip install mysqlclient>=2.0.1 django-mysql>=3.9.0
Expand Down
4 changes: 4 additions & 0 deletions actstream/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ def action_handler(verb, **kwargs):

# We must store the untranslated string
# If verb is an ugettext_lazyed string, fetch the original string
# _proxy____args is a valid attribute in Django <= 4.2
if hasattr(verb, '_proxy____args'):
verb = verb._proxy____args[0]
# _args is the new attribute in Django >= 5.0
if hasattr(verb, '_args'):
verb = verb._args[0]

newaction = apps.get_model('actstream', 'action')(
actor_content_type=ContentType.objects.get_for_model(actor),
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Changelog
=========

2.0.1
-----

- Adds support for Django 5.0

2.0.0
-----

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Make sure to pick the version of Django and django-activity-stream that supports
Python
******

* **Python 3**: 3.6 to 3.9
* **Python 3**: 3.6 to 3.12
* **PyPy**: 3

Django
Expand Down
28 changes: 22 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[tox]
envlist =
py{37,38,39}-django32-{mysql,postgres,sqlite}
py{38,39}-django40-{mysql,postgres,sqlite}
py{38,39}-django41-{mysql,postgres,sqlite}
py{37,38,39,310}-django32-{mysql,postgres,sqlite}
py{38,39,310}-django40-{mysql,postgres,sqlite}
py{38,39,310,311}-django41-{mysql,postgres,sqlite}
py{38,39,310,311,312}-django42-{mysql,postgres,sqlite}
py{310,311,312}-django50-{mysql,postgres,sqlite}
toxworkdir=/tmp/.tox

[testenv]
commands = pytest -s --cov --cov-append actstream/ runtests/testapp runtests/testapp_nested/
commands = python -m pytest -s --cov --cov-append actstream/ runtests/testapp runtests/testapp_nested/

deps =
django-rest-framework
Expand All @@ -16,10 +18,13 @@ deps =
pytest
pytest-cov
pytest-django
setuptools
coverage>=4.5.1
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
django41: Django>=4.1,<4.2
django42: Django>=4.2,<5.0
django50: Django>=5.0,<5.1
mysql: mysqlclient>=2.0.0
mysql: django-mysql>=2.4.1
postgres: psycopg2-binary>=2.8
Expand All @@ -30,7 +35,19 @@ setenv =
postgres: DATABASE_ENGINE=postgresql

; Pass this to force enable mysql/postgres dbs
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
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

usedevelop = True

Expand All @@ -53,4 +70,3 @@ DATABASE =
mysql: mysql
postgresql: postgresql
sqlite: sqlite

0 comments on commit 327d186

Please sign in to comment.