Support Django 5.0 db_default attribute.

A DB default is not considered backward incompatible, as the default value is kept on DB-level.
See https://docs.djangoproject.com/en/dev/releases/5.0/#database-computed-default-values
This commit is contained in:
David Wobrock authored and David Wobrock committed 2024-03-29 12:39:30 +01:00
1 parent 3a557cbd7c
commit 18a39cb3fc
12 files changed
+127 -13

No files matched your search

+8
View File
@@ -14,6 +14,8 @@ from __future__ import annotations
import os
import django
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -59,6 +61,12 @@ INSTALLED_APPS = [
"tests.test_project.app_create_index_exclusive",
]
if django.VERSION[0] >= 5:
# db_default attribute was only added in Django 5.0
INSTALLED_APPS.append(
"tests.test_project.app_add_not_null_column_followed_by_db_default"
)
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",