Skip to content

Commit 3de9ff6

Browse files
nosnilmotSuor
authored andcommitted
django 5.2 compatibility
Closes #494
1 parent 99cf391 commit 3de9ff6

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

cacheops/tree.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@
66
from django.db.models.sql import OR
77
from django.db.models.sql.datastructures import Join
88
from django.db.models.sql.query import Query, ExtraWhere
9-
from django.db.models.sql.where import NothingNode, SubqueryConstraint
9+
from django.db.models.sql.where import NothingNode
1010
from django.db.models.lookups import Lookup, Exact, In, IsNull
1111
from django.db.models.expressions import BaseExpression, Exists
1212

1313
from .conf import settings
1414
from .invalidation import serializable_fields
1515

16+
# This existed prior to Django 5.2
17+
try:
18+
from django.db.models.sql.where import SubqueryConstraint
19+
except ImportError:
20+
class SubqueryConstraint(object):
21+
pass
22+
1623

1724
def dnfs(qs):
1825
"""

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'Framework :: Django :: 4.1',
4545
'Framework :: Django :: 4.2',
4646
'Framework :: Django :: 5.0',
47+
'Framework :: Django :: 5.2',
4748

4849
'Environment :: Web Environment',
4950
'Intended Audience :: Developers',

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ envlist =
44
py{38,39}-dj{32,40},
55
py310-dj{32,40,41},
66
py311-dj{41,42,50},
7-
py312-dj{42,50},
8-
py313-dj{42,50},
7+
py312-dj{42,50,52},
8+
py313-dj{42,50,52},
99
pypy310-dj40
1010

1111
[gh-actions]
@@ -34,6 +34,7 @@ deps =
3434
dj41: Django>=4.1,<4.2
3535
dj42: Django>=4.2.8,<5.0
3636
dj50: Django>=5.0,<5.1
37+
dj52: Django>=5.2,<5.3
3738
djmain: git+https://github.com/django/django
3839
mysqlclient
3940
py{38,39,310,311,312,313}: psycopg2-binary

0 commit comments

Comments
 (0)