From 16098af27ee05ba7e210de76db30a790b61ba8c5 Mon Sep 17 00:00:00 2001 From: Todd Schiller Date: Fri, 31 Mar 2023 22:51:33 -0400 Subject: [PATCH] Bump to Django 4 (#512) --- .idea/codestream.xml | 2 +- .pre-commit-config.yaml | 5 +++++ openach/__init__.py | 2 -- openach/admin.py | 2 +- .../migrations/0005_evidencesource_source_date.py | 8 +++----- openach/migrations/0006_evidence_submit_date.py | 8 +++----- openach/migrations/0013_hypothesis_submit_date.py | 8 +++----- openach/migrations/0018_auto_20160919_2318.py | 8 +++----- openach/tests/test_site.py | 9 +++------ openintel/settings.py | 1 - requirements.txt | 14 +++++++------- 11 files changed, 29 insertions(+), 38 deletions(-) diff --git a/.idea/codestream.xml b/.idea/codestream.xml index 0ada1bb7..76eadaf0 100644 --- a/.idea/codestream.xml +++ b/.idea/codestream.xml @@ -2,6 +2,6 @@ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2fae963b..5fa60cf5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,11 @@ repos: hooks: - id: pyupgrade args: ["--py310-plus"] + - repo: https://github.com/adamchainz/django-upgrade + rev: 1.13.0 # replace with latest tag on GitHub + hooks: + - id: django-upgrade + args: [--target-version, "4.1"] # Replace with Django version - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: diff --git a/openach/__init__.py b/openach/__init__.py index 5e9cd8b1..c059c4bd 100644 --- a/openach/__init__.py +++ b/openach/__init__.py @@ -1,3 +1 @@ """Analysis of Competing Hypotheses Django application module.""" - -default_app_config = "openach.apps.OpenACHConfig" diff --git a/openach/admin.py b/openach/admin.py index f7ea87b6..1070ba18 100644 --- a/openach/admin.py +++ b/openach/admin.py @@ -22,13 +22,13 @@ class EvidenceInline(admin.StackedInline): extra = 2 +@admin.register(Board) class BoardAdmin(admin.ModelAdmin): """Admin interface for editing ACH boards.""" inlines = [HypothesisInline, EvidenceInline] -admin.site.register(Board, BoardAdmin) admin.site.register(EvidenceSourceTag) admin.site.register(ProjectNews) admin.site.register(Team) diff --git a/openach/migrations/0005_evidencesource_source_date.py b/openach/migrations/0005_evidencesource_source_date.py index 34c48f69..bab3bcc5 100644 --- a/openach/migrations/0005_evidencesource_source_date.py +++ b/openach/migrations/0005_evidencesource_source_date.py @@ -1,15 +1,11 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-26 16:56 -from __future__ import unicode_literals import datetime from django.db import migrations, models -from django.utils.timezone import utc class Migration(migrations.Migration): - dependencies = [ ("openach", "0004_auto_20160826_1651"), ] @@ -19,7 +15,9 @@ class Migration(migrations.Migration): model_name="evidencesource", name="source_date", field=models.DateField( - default=datetime.datetime(2016, 8, 26, 16, 56, 39, 255717, tzinfo=utc), + default=datetime.datetime( + 2016, 8, 26, 16, 56, 39, 255717, tzinfo=datetime.timezone.utc + ), verbose_name="source date", ), preserve_default=False, diff --git a/openach/migrations/0006_evidence_submit_date.py b/openach/migrations/0006_evidence_submit_date.py index e35de7df..4f43f765 100644 --- a/openach/migrations/0006_evidence_submit_date.py +++ b/openach/migrations/0006_evidence_submit_date.py @@ -1,15 +1,11 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-26 17:29 -from __future__ import unicode_literals import datetime from django.db import migrations, models -from django.utils.timezone import utc class Migration(migrations.Migration): - dependencies = [ ("openach", "0005_evidencesource_source_date"), ] @@ -19,7 +15,9 @@ class Migration(migrations.Migration): model_name="evidence", name="submit_date", field=models.DateTimeField( - default=datetime.datetime(2016, 8, 26, 17, 29, 46, 660576, tzinfo=utc), + default=datetime.datetime( + 2016, 8, 26, 17, 29, 46, 660576, tzinfo=datetime.timezone.utc + ), verbose_name="date added", ), preserve_default=False, diff --git a/openach/migrations/0013_hypothesis_submit_date.py b/openach/migrations/0013_hypothesis_submit_date.py index 97436d1d..906ee989 100644 --- a/openach/migrations/0013_hypothesis_submit_date.py +++ b/openach/migrations/0013_hypothesis_submit_date.py @@ -1,15 +1,11 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-30 03:05 -from __future__ import unicode_literals import datetime from django.db import migrations, models -from django.utils.timezone import utc class Migration(migrations.Migration): - dependencies = [ ("openach", "0012_auto_20160829_2127"), ] @@ -19,7 +15,9 @@ class Migration(migrations.Migration): model_name="hypothesis", name="submit_date", field=models.DateTimeField( - default=datetime.datetime(2016, 8, 30, 3, 5, 15, 430181, tzinfo=utc), + default=datetime.datetime( + 2016, 8, 30, 3, 5, 15, 430181, tzinfo=datetime.timezone.utc + ), verbose_name="date added", ), preserve_default=False, diff --git a/openach/migrations/0018_auto_20160919_2318.py b/openach/migrations/0018_auto_20160919_2318.py index 0dd76d12..55db1f7b 100644 --- a/openach/migrations/0018_auto_20160919_2318.py +++ b/openach/migrations/0018_auto_20160919_2318.py @@ -1,15 +1,11 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-19 23:18 -from __future__ import unicode_literals import datetime from django.db import migrations, models -from django.utils.timezone import utc class Migration(migrations.Migration): - dependencies = [ ("openach", "0017_evaluation_timestamp"), ] @@ -19,7 +15,9 @@ class Migration(migrations.Migration): model_name="evaluation", name="timestamp", field=models.DateTimeField( - default=datetime.datetime(2016, 9, 19, 23, 18, 19, 119681, tzinfo=utc), + default=datetime.datetime( + 2016, 9, 19, 23, 18, 19, 119681, tzinfo=datetime.timezone.utc + ), verbose_name="date evaluated", ), preserve_default=False, diff --git a/openach/tests/test_site.py b/openach/tests/test_site.py index bdd0e466..de13293c 100644 --- a/openach/tests/test_site.py +++ b/openach/tests/test_site.py @@ -43,11 +43,9 @@ def test_show_published_news(self): def test_index_view_with_a_past_board(self): """Test that board with a pub_date in the past should be displayed on the index page.""" - create_board(board_title="Past board.", days=-30) + board = create_board(board_title="Past board.", days=-30) response = self.client.get(reverse("openach:index")) - self.assertQuerysetEqual( - response.context["latest_board_list"], [""] - ) + self.assertQuerysetEqual(response.context["latest_board_list"], [board]) class BannerTests(TestCase): @@ -56,7 +54,7 @@ def test_show_banner(self): msg = "Test banner message" setattr(settings, "BANNER_MESSAGE", msg) for page in ["index", "boards", "about"]: - response = self.client.get(reverse("openach:{}".format(page))) + response = self.client.get(reverse(f"openach:{page}")) self.assertContains(response, msg, status_code=200) def test_do_not_show_empty_banner(self): @@ -69,7 +67,6 @@ def test_do_not_show_empty_banner(self): class AboutViewTests(TestCase): - address = "abc123" def test_can_render_about_page(self): diff --git a/openintel/settings.py b/openintel/settings.py index 735010fc..40c47215 100644 --- a/openintel/settings.py +++ b/openintel/settings.py @@ -252,7 +252,6 @@ def _detect_command(cmd): USE_I18N = True -USE_L10N = True USE_TZ = True diff --git a/requirements.txt b/requirements.txt index 7d49d034..0828cc04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,15 +3,15 @@ beautifulsoup4==4.9.3 celery==5.2.7 dj-database-url==1.2.0 -django-allauth==0.52.0 +django-allauth==0.54.0 django-bootstrap-form==3.4 -django-contrib-comments==2.1.0 +django-contrib-comments==2.2.0 django-csp==3.7 django-environ==0.9.0 django-field-history==0.8.0 -django-invitations==1.9.3 -django-notifications-hq==1.6.0 -Django==3.2.17 +django-invitations==2.0.0 +django-notifications-hq==1.7.0 +Django==4.1.7 python-slugify==4.0.1 qrcode==6.1 tldextract==3.4.0 @@ -22,7 +22,7 @@ django-recaptcha==3.0.0 django-sendgrid-v5==1.1.0 psycopg2-binary==2.9.5 -pylibmc==1.6.1 +pylibmc==1.6.3 redis==4.4.4 rollbar==0.16.3 @@ -33,7 +33,7 @@ whitenoise==6.3.0 # dev dependencies -django-webpack-loader==1.8.0 +django-webpack-loader==1.8.1 nplusone==1.0.0 pre-commit==2.14.0 django-debug-toolbar==3.2.2