Skip to content

Commit 4b375a4

Browse files
committed
Add support for Django 6.0
Django 5.0 LTS ended mainstream support on 12/3/25. This updates the tox testing matrix and GitHub Action to test against Django 6.0 with Python 3.13. It drops explicit testing against 5.1 to keep the matrix from becoming too large. We now test against 4.2, 5.2, and 6.0 (all LTS). We can remove some deprecated Django version checks that were only relevant for older versions. The docs for unique_together indicate that it may be deprecated in future [0]. This note was added to the docs way back in Django 2.2. This commit modernizes our constraint to use models.UniqueConstraint instead. Pyproject classifiers have been updated to add Django 6.0. [0] https://docs.djangoproject.com/en/6.0/ref/models/options/#django.db.models.Options.unique_together
1 parent d0dd347 commit 4b375a4

9 files changed

Lines changed: 46 additions & 25 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ jobs:
3535
django: "4.2"
3636
- python: "3.13"
3737
django: "4.2"
38-
- python: "3.12"
39-
django: "5.1"
40-
- python: "3.13"
41-
django: "5.1"
4238
- python: "3.12"
4339
django: "5.2"
4440
- python: "3.13"
4541
django: "5.2"
42+
- python: "3.12"
43+
django: "6.0"
44+
- python: "3.13"
45+
django: "6.0"
4646

4747
steps:
4848
- uses: actions/checkout@v5

docs/releasenotes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release Notes
22

3+
## Unreleased
4+
5+
### What's new?
6+
7+
- Added support for Django 6.0
8+
- Removed obsolete Django version checks
9+
10+
311
## 5.1.0
412

513
### What's new?

flags/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
import django
2-
3-
4-
if django.VERSION < (3, 2):
5-
default_app_config = "flags.apps.DjangoFlagsConfig"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 6.0.2 on 2026-02-10 15:23
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("flags", "0013_add_required_field"),
10+
]
11+
12+
operations = [
13+
migrations.AlterUniqueTogether(
14+
name="flagstate",
15+
unique_together=set(),
16+
),
17+
migrations.AddConstraint(
18+
model_name="flagstate",
19+
constraint=models.UniqueConstraint(
20+
fields=("name", "condition", "value"),
21+
name="flags_flagstate_unique_name_condition_value",
22+
),
23+
),
24+
]

flags/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ class FlagState(models.Model):
99

1010
class Meta:
1111
app_label = "flags"
12-
unique_together = ("name", "condition", "value")
12+
constraints = [
13+
models.UniqueConstraint(
14+
fields=["name", "condition", "value"],
15+
name="flags_flagstate_unique_name_condition_value",
16+
)
17+
]
1318

1419
def __str__(self):
1520
return (

flags/tests/test_conditions_validators.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import django
21
from django.contrib.auth import get_user_model
32
from django.core.exceptions import ValidationError
43
from django.test import TestCase, override_settings
@@ -89,13 +88,6 @@ def test_invalid_date_strings(self):
8988
with self.assertRaises(ValidationError):
9089
validate_date("tomorrowish")
9190

92-
# Django 4.0 relies on Python 3.7+'s `datetime.fromisoformat()`, which
93-
# handles this where the old regex did not. This is now valid when on
94-
# Django 4.0+. See https://github.com/django/django/pull/14582
95-
if django.VERSION < (4, 0):
96-
with self.assertRaises(ValidationError):
97-
validate_date("2020-04-01")
98-
9991
def test_valid_date_strings(self):
10092
validate_date("2020-04-01T12:00")
10193
validate_date("2020-04-01T12:00+04:00")

flags/tests/testapp/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
import django
2-
3-
4-
if django.VERSION < (3, 2):
5-
default_app_config = "flags.tests.testapp.apps.TestAppConfig"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ classifiers = [
2020
"Framework :: Django :: 4.2",
2121
"Framework :: Django :: 5.1",
2222
"Framework :: Django :: 5.2",
23+
"Framework :: Django :: 6.0",
2324
"Programming Language :: Python",
2425
"Programming Language :: Python :: 3",
2526
"Programming Language :: Python :: 3.10",

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ skipsdist=True
33
envlist=
44
lint,
55
python{3.10,3.13}-django4.2
6-
python{3.12,3.13}-django{5.1,5.2}
6+
python{3.12,3.13}-django5.2
7+
python{3.12,3.13}-django6.0
78
coverage
89

910
[testenv]
@@ -20,8 +21,8 @@ basepython=
2021

2122
deps=
2223
django4.2: Django~=4.2
23-
django5.1: Django~=5.1
2424
django5.2: Django~=5.2
25+
django6.0: Django~=6.0
2526

2627
[testenv:lint]
2728
basepython=python3.13

0 commit comments

Comments
 (0)