Skip to content

Commit

Permalink
Add support for Django 4.1
Browse files Browse the repository at this point in the history
    * Strip IDENTITY related suffixes auto fields are getting on Django 4.1.
      These suffixes are upsetting redshift.
  • Loading branch information
fizyk committed Nov 24, 2022
1 parent 3173766 commit e6ab40d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ jobs:
max-parallel: 5
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
django-version: ['3.2', '4.0']
django-version: ['3.2', '4.0', '4.1']
exclude:
- django-version: '4.0'
python-version: '3.7'
- django-version: '4.1'
python-version: '3.7'
include:
- django-version: 'main'
python-version: '3.9'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ doc/_build/
coverage.xml
**/.env
examples/**/migrations/*
.idea/
4 changes: 4 additions & 0 deletions django_redshift_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,10 @@ class DatabaseWrapper(BasePGDatabaseWrapper):
data_types = deepcopy(BasePGDatabaseWrapper.data_types)
data_types.update(redshift_data_types)

# Clear suffixes to rid of PostgreSQLs GENERATED BY DEFAULT AS IDENTITY that upset Redshift.
# Takes effect on Django>=4.1. Older version have this attribute empty
data_types_suffix = {}

def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Support versions
This product is tested with:

* Python-3.7, 3.8, 3.9, 3.10
* Django-3.2, 4.0
* Django-3.2, 4.0, 4.1

License
=======
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers =
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Framework :: Django :: 4.1
Intended Audience :: Developers
Environment :: Plugins
Topic :: Software Development :: Libraries :: Python Modules
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ python =
DJANGO =
3.2: dj32
4.0: dj40
4.1: dj41
main: djmain

[testenv]
Expand Down

0 comments on commit e6ab40d

Please sign in to comment.