From 5665d9e4cc42c96a525a5a90b8aa05bec6818a69 Mon Sep 17 00:00:00 2001 From: powderflask Date: Thu, 5 May 2022 19:48:04 -0700 Subject: [PATCH 1/2] django3.2 compatibility --- pinax/notifications/__init__.py | 4 +++- pinax/notifications/apps.py | 2 +- pinax/notifications/backends/email.py | 4 ++-- pinax/notifications/models.py | 2 +- pinax/notifications/tests/urls.py | 4 ++-- pinax/notifications/urls.py | 4 ++-- runtests.py | 3 ++- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pinax/notifications/__init__.py b/pinax/notifications/__init__.py index 08b8c0fd..b280ca29 100644 --- a/pinax/notifications/__init__.py +++ b/pinax/notifications/__init__.py @@ -1,4 +1,6 @@ import pkg_resources +import django -default_app_config = "pinax.notifications.apps.AppConfig" +if django.VERSION < (3, 2): + default_app_config = "pinax.notifications.apps.AppConfig" __version__ = pkg_resources.get_distribution("pinax-notifications").version diff --git a/pinax/notifications/apps.py b/pinax/notifications/apps.py index ea8b6ae0..cf8bebab 100644 --- a/pinax/notifications/apps.py +++ b/pinax/notifications/apps.py @@ -1,5 +1,5 @@ from django.apps import AppConfig as BaseAppConfig -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class AppConfig(BaseAppConfig): diff --git a/pinax/notifications/backends/email.py b/pinax/notifications/backends/email.py index c5801b73..f46fe35a 100644 --- a/pinax/notifications/backends/email.py +++ b/pinax/notifications/backends/email.py @@ -1,7 +1,7 @@ from django.conf import settings from django.core.mail import send_mail from django.template.loader import render_to_string -from django.utils.translation import ugettext +from django.utils.translation import gettext from .base import BaseBackend @@ -22,7 +22,7 @@ def deliver(self, recipient, sender, notice_type, extra_context): context.update({ "recipient": recipient, "sender": sender, - "notice": ugettext(notice_type.display), + "notice": gettext(notice_type.display), }) context.update(extra_context) diff --git a/pinax/notifications/models.py b/pinax/notifications/models.py index 0bed5943..22173636 100644 --- a/pinax/notifications/models.py +++ b/pinax/notifications/models.py @@ -7,7 +7,7 @@ from django.db import models from django.db.models.query import QuerySet from django.utils.translation import activate, get_language -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .conf import settings from .hooks import hookset diff --git a/pinax/notifications/tests/urls.py b/pinax/notifications/tests/urls.py index 44c67c85..60d7b1d7 100644 --- a/pinax/notifications/tests/urls.py +++ b/pinax/notifications/tests/urls.py @@ -1,5 +1,5 @@ -from django.conf.urls import include, url +from django.urls import include, path urlpatterns = [ - url(r"^notifications/", include("pinax.notifications.urls", namespace="pinax_notifications")), + path("notifications/", include("pinax.notifications.urls", namespace="pinax_notifications")), ] diff --git a/pinax/notifications/urls.py b/pinax/notifications/urls.py index 4520eb46..57e3ae7b 100644 --- a/pinax/notifications/urls.py +++ b/pinax/notifications/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import url +from django.urls import path from .views import NoticeSettingsView app_name = "pinax_notifications" urlpatterns = [ - url(r"^settings/$", NoticeSettingsView.as_view(), name="notice_settings"), + path("settings/", NoticeSettingsView.as_view(), name="notice_settings"), ] diff --git a/runtests.py b/runtests.py index 0d0ebd80..a7643841 100644 --- a/runtests.py +++ b/runtests.py @@ -47,7 +47,8 @@ ], }, }, - ] + ], + DEFAULT_AUTO_FIELD='django.db.models.BigAutoField', ) From 0e561153234e15972233ff87c61b01b601c6dde7 Mon Sep 17 00:00:00 2001 From: powderflask Date: Thu, 5 May 2022 19:49:05 -0700 Subject: [PATCH 2/2] add new LTS releases / remove unsupported --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 8348d22f..d3fe7480 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ show_missing = True [tox] envlist = checkqa, - py{36,37,38}-dj{22,30} + py{37,38,39}-dj{22,32} [testenv] passenv = CI CIRCLECI CIRCLE_* @@ -36,7 +36,7 @@ deps = coverage<5 codecov dj22: Django>=2.2,<3.0 - dj30: Django>=3.0,<3.1 + dj32: Django>=3.2,<3.3 master: https://github.com/django/django/tarball/master usedevelop = True