Skip to content

Commit

Permalink
Add Django-5.0 support #143; fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shimizukawa committed Jul 28, 2024
1 parent b63286c commit 22cd98c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import warnings
from collections import deque
from contextlib import contextmanager
from datetime import timezone as pytimezone

try:
import zoneinfo
Expand All @@ -23,6 +24,9 @@
from django.utils.asyncio import async_unsafe
from django.utils.functional import cached_property

# django.utils.timezone.utc has been removed in django 5.0
timezone.utc = pytimezone.utc

NO_DB_ALIAS = "__no_db__"


Expand Down
4 changes: 3 additions & 1 deletion django_redshift_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class DatabaseFeatures(BasePGDatabaseFeatures):
# since django-4.2. I don't know the Redshift supports comments or not.
supports_comments = False
# since django-5.0. I don't know the Redshift supports default expression
supports_default_keyword_in_insert = False # TODO: research
supports_default_keyword_in_insert = True # TODO: Add UnitTest https://docs.djangoproject.com/en/5.0/releases/5.0/#database-computed-default-values
supports_default_keyword_in_bulk_insert = True # TODO: Add UnitTest https://docs.djangoproject.com/en/5.0/releases/5.0/#database-computed-default-values
supports_nulls_distinct_unique_constraints = False # TODO: Add UnitTest https://docs.djangoproject.com/en/5.0/ref/models/constraints/#nulls-distinct

# If support atomic for ddl, we should implement non-atomic migration for on rename and change type(size)
# refs django-redshift-backend #96
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"django<5",
"django<5.1",
"backports.zoneinfo;python_version<'3.9'",
]

Expand Down

0 comments on commit 22cd98c

Please sign in to comment.