From fed36cc12e3c6c049920019097b7ddc1bd51f094 Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 14 Apr 2022 22:11:37 -0400 Subject: [PATCH] Fix basic Django 3.2 incompatibilities --- dmoj_install_pymysql.py | 2 +- judge/utils/raw_sql.py | 5 ++++- requirements.txt | 16 ++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dmoj_install_pymysql.py b/dmoj_install_pymysql.py index b42bed10e..068715508 100644 --- a/dmoj_install_pymysql.py +++ b/dmoj_install_pymysql.py @@ -1,4 +1,4 @@ import pymysql pymysql.install_as_MySQLdb() -pymysql.version_info = (1, 3, 13, 'final', 0) +pymysql.version_info = (1, 4, 0, 'final', 0) diff --git a/judge/utils/raw_sql.py b/judge/utils/raw_sql.py index 6dbeb9c30..646d3b10f 100644 --- a/judge/utils/raw_sql.py +++ b/judge/utils/raw_sql.py @@ -55,7 +55,10 @@ def join_sql_subquery(queryset, subquery, params, join_fields, alias, join_type= parent_alias = parent_model._meta.db_table else: parent_alias = queryset.query.get_initial_alias() - queryset.query.external_aliases.add(alias) + if isinstance(queryset.query.external_aliases, dict): # Django 3.x + queryset.query.external_aliases[alias] = True + else: + queryset.query.external_aliases.add(alias) join = RawSQLJoin(subquery, params, parent_alias, alias, join_type, FakeJoinField(join_fields), join_type == LOUTER) queryset.query.join(join) join.table_alias = alias diff --git a/requirements.txt b/requirements.txt index 2b3c0d86b..79fc436e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ -Django>=2.2,<3 -django_compressor -django-mptt +Django>=3.2,<4 +django_compressor>=3 +django-mptt>=0.13 django-pagedown<2 -django-registration-redux -django-reversion +django-registration-redux>=2.10 +django-reversion>=3.0.5,<4 django-social-share -django-sortedm2m @ git+https://github.com/DMOJ/django-sortedm2m.git +django-sortedm2m>=3.1.0 django-impersonate dmoj-wpadmin @ git+https://github.com/DMOJ/dmoj-wpadmin.git lxml @@ -18,13 +18,13 @@ pika ua-parser pyyaml jinja2 -django_jinja +django_jinja>=2.5.0 llist requests django-fernet-fields pyotp qrcode[pil] -jsonfield +jsonfield>=3.0.3 pymoss packaging celery