Update to Django 4.0

This commit is contained in:
Florian Eitel 2023-01-14 13:23:41 +01:00
parent 6a6d9a5ab2
commit 1aed14f487
Signed by: flo
GPG Key ID: 9987EAFEF6F686BB
18 changed files with 76 additions and 83 deletions

View File

@ -6,7 +6,7 @@ name = "pypi"
[packages] [packages]
dnspython = "*" dnspython = "*"
netaddr = "*" netaddr = "*"
django = "~=3.2.0" django = "~=4.0.0"
django-bootstrap-form = "*" django-bootstrap-form = "*"
django-referrer-policy = "*" django-referrer-policy = "*"
django-registration-redux = "*" django-registration-redux = "*"

21
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "2d84c864a69bb0acaa84f8ef23dab9dd7c5311888976f1a0f022e3c8c39d6836" "sha256": "5fbe7a1db419af7b2b43b27cfcd7e9e69e295019a597bdaf1d95c875513c75f8"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -233,11 +233,11 @@
}, },
"django": { "django": {
"hashes": [ "hashes": [
"sha256:18ba8efa36b69cfcd4b670d0fa187c6fe7506596f0ababe580e16909bcdec121", "sha256:07e6433f263c3839939cfabeb6d7557841e0419e47759a7b7d37f6d44d40adcb",
"sha256:3adc285124244724a394fa9b9839cc8cd116faf7d159554c43ecdaa8cdf0b94d" "sha256:27cb08fa6458c1eff8b97c4c2d03774646fb26feeaa4587dca10c49e6d4fc6a3"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.2.16" "version": "==4.0.8"
}, },
"django-bootstrap-form": { "django-bootstrap-form": {
"hashes": [ "hashes": [
@ -331,13 +331,6 @@
], ],
"version": "==3.2.0" "version": "==3.2.0"
}, },
"pytz": {
"hashes": [
"sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0",
"sha256:78f4f37d8198e0627c5f1143240bb0206b8691d8d7ac6d78fee88b78733f8c4a"
],
"version": "==2022.7.1"
},
"requests": { "requests": {
"hashes": [ "hashes": [
"sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa", "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa",
@ -571,11 +564,11 @@
}, },
"django": { "django": {
"hashes": [ "hashes": [
"sha256:18ba8efa36b69cfcd4b670d0fa187c6fe7506596f0ababe580e16909bcdec121", "sha256:07e6433f263c3839939cfabeb6d7557841e0419e47759a7b7d37f6d44d40adcb",
"sha256:3adc285124244724a394fa9b9839cc8cd116faf7d159554c43ecdaa8cdf0b94d" "sha256:27cb08fa6458c1eff8b97c4c2d03774646fb26feeaa4587dca10c49e6d4fc6a3"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.2.16" "version": "==4.0.8"
}, },
"django-debug-toolbar": { "django-debug-toolbar": {
"hashes": [ "hashes": [

View File

@ -1,7 +1,7 @@
# packages always needed # packages always needed
dnspython dnspython
netaddr netaddr
django~=3.2.0 django~=4.0.0
django-bootstrap-form django-bootstrap-form
django-referrer-policy django-referrer-policy
django-registration-redux django-registration-redux

View File

@ -31,7 +31,7 @@ setup(
install_requires=[ install_requires=[
'dnspython', 'dnspython',
'netaddr', 'netaddr',
'django>=3.2.0', 'django>=4.0.0',
'django-bootstrap-form', 'django-bootstrap-form',
'django-referrer-policy', 'django-referrer-policy',
'django-registration-redux', 'django-registration-redux',

View File

@ -7,9 +7,9 @@ from django.conf import settings
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.dispatch import receiver from django.dispatch import receiver
from django.contrib.auth.signals import user_logged_in from django.contrib.auth.signals import user_logged_in
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.utils.translation import LANGUAGE_SESSION_KEY
LANGUAGE_SESSION_KEY = "_language"
class UserProfile(models.Model): class UserProfile(models.Model):
""" """

View File

@ -7,7 +7,7 @@ logger = logging.getLogger(__name__)
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from registration.forms import RegistrationForm from registration.forms import RegistrationForm

View File

@ -1,4 +1,4 @@
from django.conf.urls import url from django.urls import re_path
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from registration.backends.default.views import ActivationView from registration.backends.default.views import ActivationView
@ -8,12 +8,12 @@ from .views import UserProfileView, DeleteUserView, UserChangePasswordView
urlpatterns = ( urlpatterns = (
url(r'^profile/', UserProfileView.as_view(), name="account_profile"), re_path(r'^profile/', UserProfileView.as_view(), name="account_profile"),
url(r'^settings/', UserChangePasswordView.as_view(), name='account_settings'), re_path(r'^settings/', UserChangePasswordView.as_view(), name='account_settings'),
url(r'^delete/', DeleteUserView.as_view(), name="account_delete"), re_path(r'^delete/', DeleteUserView.as_view(), name="account_delete"),
# registration start # registration start
url(r'^activate/complete/$', re_path(r'^activate/complete/$',
TemplateView.as_view(template_name='registration/activation_complete.html'), TemplateView.as_view(template_name='registration/activation_complete.html'),
name='registration_activation_complete'), name='registration_activation_complete'),
# Activation keys get matched by \w+ instead of the more specific # Activation keys get matched by \w+ instead of the more specific
@ -21,16 +21,16 @@ urlpatterns = (
# that way it can return a sensible "invalid key" message instead of a # that way it can return a sensible "invalid key" message instead of a
# confusing 404. # confusing 404.
url(r'^activate/(?P<activation_key>\w+)/$', re_path(r'^activate/(?P<activation_key>\w+)/$',
ActivationView.as_view(), ActivationView.as_view(),
name='registration_activate'), name='registration_activate'),
url(r'^register/$', re_path(r'^register/$',
RegistrationView.as_view(), RegistrationView.as_view(),
name='registration_register'), name='registration_register'),
url(r'^register/complete/$', re_path(r'^register/complete/$',
TemplateView.as_view(template_name='registration/registration_complete.html'), TemplateView.as_view(template_name='registration/registration_complete.html'),
name='registration_complete'), name='registration_complete'),
url(r'^register/closed/$', re_path(r'^register/closed/$',
TemplateView.as_view(template_name='registration/registration_closed.html'), TemplateView.as_view(template_name='registration/registration_closed.html'),
name='registration_disallowed'), name='registration_disallowed'),
# registration end # registration end

View File

@ -10,7 +10,7 @@ from django.views.decorators.debug import sensitive_post_parameters
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.shortcuts import redirect from django.shortcuts import redirect
from django.contrib import messages from django.contrib import messages
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.contrib.auth import update_session_auth_hash from django.contrib.auth import update_session_auth_hash
from .forms import UserForm, UserProfileForm from .forms import UserForm, UserProfileForm

View File

@ -1,25 +1,25 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf.urls import url from django.urls import re_path
from django.contrib.auth.views import LoginView, LogoutView, \ from django.contrib.auth.views import LoginView, LogoutView, \
PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView
urlpatterns = ( urlpatterns = (
# login and logout url # login and logout url
url(r'^login/$', LoginView.as_view(template_name='login.html'), name='login'), re_path(r'^login/$', LoginView.as_view(template_name='login.html'), name='login'),
# or use logout with template 'logout.html' # or use logout with template 'logout.html'
url(r'^logout/$', LogoutView.as_view(), name='logout'), re_path(r'^logout/$', LogoutView.as_view(), name='logout'),
# password reset urls # password reset urls
url(r'^password_reset/$', re_path(r'^password_reset/$',
PasswordResetView.as_view(template_name='password_reset.html'), PasswordResetView.as_view(template_name='password_reset.html'),
name='password_reset'), name='password_reset'),
url(r'^password_reset_done/$', re_path(r'^password_reset_done/$',
PasswordResetDoneView.as_view(template_name='password_reset_done.html'), PasswordResetDoneView.as_view(template_name='password_reset_done.html'),
name='password_reset_done'), name='password_reset_done'),
url(r'^password_reset_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', re_path(r'^password_reset_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
PasswordResetConfirmView.as_view(template_name='password_reset_confirm.html'), PasswordResetConfirmView.as_view(template_name='password_reset_confirm.html'),
name='password_reset_confirm'), name='password_reset_confirm'),
url(r'^password_reset_complete/$', re_path(r'^password_reset_complete/$',
PasswordResetCompleteView.as_view(template_name='password_reset_complete.html'), PasswordResetCompleteView.as_view(template_name='password_reset_complete.html'),
name='password_reset_complete'), name='password_reset_complete'),
) )

View File

@ -6,7 +6,7 @@ form definitions (which fields are available, order, autofocus, ...)
import binascii import binascii
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from .models import Host, RelatedHost, Domain, ServiceUpdaterHostConfig from .models import Host, RelatedHost, Domain, ServiceUpdaterHostConfig
from .dnstools import check_domain, NameServerNotAvailable from .dnstools import check_domain, NameServerNotAvailable

View File

@ -17,7 +17,7 @@ from django.conf import settings
from django.db.models.signals import pre_delete, post_save from django.db.models.signals import pre_delete, post_save
from django.contrib.auth.hashers import make_password from django.contrib.auth.hashers import make_password
from django.utils.timezone import now from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from . import dnstools from . import dnstools

View File

@ -2,7 +2,7 @@
main app url dispatching main app url dispatching
""" """
from django.conf.urls import url from django.urls import re_path
from .views import ( from .views import (
HomeView, OverviewView, HostView, AddHostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView, HomeView, OverviewView, HostView, AddHostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView,
@ -16,39 +16,39 @@ from ..api.views import (
urlpatterns = ( urlpatterns = (
# interactive web ui # interactive web ui
url(r'^$', HomeView.as_view(), name="home"), re_path(r'^$', HomeView.as_view(), name="home"),
url(r'^about/$', AboutView.as_view(), name="about"), re_path(r'^about/$', AboutView.as_view(), name="about"),
url(r'^custom/(?P<template>[\w.]+)$', CustomTemplateView.as_view(), name="custom"), re_path(r'^custom/(?P<template>[\w.]+)$', CustomTemplateView.as_view(), name="custom"),
url(r'^update$', JsUpdateView.as_view(), name='update'), re_path(r'^update$', JsUpdateView.as_view(), name='update'),
url(r'^overview/$', OverviewView.as_view(), name='overview'), re_path(r'^overview/$', OverviewView.as_view(), name='overview'),
url(r'^status/$', StatusView.as_view(), name='status'), re_path(r'^status/$', StatusView.as_view(), name='status'),
url(r'^generate_secret/(?P<pk>\d+)/$', GenerateSecretView.as_view(), name='generate_secret_view'), re_path(r'^generate_secret/(?P<pk>\d+)/$', GenerateSecretView.as_view(), name='generate_secret_view'),
url(r'^generate_ns_secret/(?P<pk>\d+)/$', GenerateNSSecretView.as_view(), name='generate_ns_secret_view'), re_path(r'^generate_ns_secret/(?P<pk>\d+)/$', GenerateNSSecretView.as_view(), name='generate_ns_secret_view'),
url(r'^host/(?P<pk>\d+)/$', HostView.as_view(), name='host_view'), re_path(r'^host/(?P<pk>\d+)/$', HostView.as_view(), name='host_view'),
url(r'^host/add/$', AddHostView.as_view(), name='add_host'), re_path(r'^host/add/$', AddHostView.as_view(), name='add_host'),
url(r'^host/(?P<pk>\d+)/delete/$', DeleteHostView.as_view(), name='delete_host'), re_path(r'^host/(?P<pk>\d+)/delete/$', DeleteHostView.as_view(), name='delete_host'),
url(r'^host/(?P<mpk>\d+)/related/$', RelatedHostOverviewView.as_view(), name='related_host_overview'), re_path(r'^host/(?P<mpk>\d+)/related/$', RelatedHostOverviewView.as_view(), name='related_host_overview'),
url(r'^host/(?P<mpk>\d+)/related/(?P<pk>\d+)/$', RelatedHostView.as_view(), name='related_host_view'), re_path(r'^host/(?P<mpk>\d+)/related/(?P<pk>\d+)/$', RelatedHostView.as_view(), name='related_host_view'),
url(r'^host/(?P<mpk>\d+)/related/add/$', AddRelatedHostView.as_view(), name='add_related_host'), re_path(r'^host/(?P<mpk>\d+)/related/add/$', AddRelatedHostView.as_view(), name='add_related_host'),
url(r'^host/(?P<mpk>\d+)/related/(?P<pk>\d+)/delete/$', DeleteRelatedHostView.as_view(), re_path(r'^host/(?P<mpk>\d+)/related/(?P<pk>\d+)/delete/$', DeleteRelatedHostView.as_view(),
name='delete_related_host'), name='delete_related_host'),
url(r'^domain/(?P<pk>\d+)/$', DomainView.as_view(), name='domain_view'), re_path(r'^domain/(?P<pk>\d+)/$', DomainView.as_view(), name='domain_view'),
url(r'^domain/add/$', AddDomainView.as_view(), name='add_domain'), re_path(r'^domain/add/$', AddDomainView.as_view(), name='add_domain'),
url(r'^domain/(?P<pk>\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'), re_path(r'^domain/(?P<pk>\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'),
url(r'^updater_hostconfig_overview/(?P<pk>\d+)/$', UpdaterHostConfigOverviewView.as_view(), re_path(r'^updater_hostconfig_overview/(?P<pk>\d+)/$', UpdaterHostConfigOverviewView.as_view(),
name='updater_hostconfig_overview'), name='updater_hostconfig_overview'),
url(r'^updater_hostconfig/(?P<pk>\d+)/$', UpdaterHostConfigView.as_view(), name='updater_hostconfig'), re_path(r'^updater_hostconfig/(?P<pk>\d+)/$', UpdaterHostConfigView.as_view(), name='updater_hostconfig'),
url(r'^updater_hostconfig/(?P<pk>\d+)/delete/$', DeleteUpdaterHostConfigView.as_view(), re_path(r'^updater_hostconfig/(?P<pk>\d+)/delete/$', DeleteUpdaterHostConfigView.as_view(),
name='delete_updater_hostconfig'), name='delete_updater_hostconfig'),
# internal use by the web ui # internal use by the web ui
url(r'^detectip/(?P<sessionid>\w+)/$', DetectIpView.as_view(), name='detectip'), re_path(r'^detectip/(?P<sessionid>\w+)/$', DetectIpView.as_view(), name='detectip'),
url(r'^ajax_get_ips/$', AjaxGetIps.as_view(), name="ajax_get_ips"), re_path(r'^ajax_get_ips/$', AjaxGetIps.as_view(), name="ajax_get_ips"),
url(r'^nic/update_authorized$', AuthorizedNicUpdateView.as_view(), name='nic_update_authorized'), re_path(r'^nic/update_authorized$', AuthorizedNicUpdateView.as_view(), name='nic_update_authorized'),
url(r'^nic/delete_authorized$', AuthorizedNicDeleteView.as_view(), name='nic_delete_authorized'), re_path(r'^nic/delete_authorized$', AuthorizedNicDeleteView.as_view(), name='nic_delete_authorized'),
# api (for update clients) # api (for update clients)
url(r'^myip$', myip_view, name='myip'), re_path(r'^myip$', myip_view, name='myip'),
url(r'^nic/update$', NicUpdateView.as_view(), name='nic_update'), re_path(r'^nic/update$', NicUpdateView.as_view(), name='nic_update'),
url(r'^nic/delete$', NicDeleteView.as_view(), name='nic_delete'), # api extension re_path(r'^nic/delete$', NicDeleteView.as_view(), name='nic_delete'), # api extension
# for bots # for bots
url(r'^robots.txt$', RobotsTxtView.as_view(), name='robots'), re_path(r'^robots.txt$', RobotsTxtView.as_view(), name='robots'),
) )

View File

@ -8,7 +8,7 @@ import dns.message
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.core.mail import send_mail from django.core.mail import send_mail
from django.db import transaction from django.db import transaction
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from nsupdate.main.models import Domain, Host from nsupdate.main.models import Domain, Host
from nsupdate.main.dnstools import FQDN, query_ns, NameServerNotAvailable from nsupdate.main.dnstools import FQDN, query_ns, NameServerNotAvailable

View File

@ -7,7 +7,7 @@ import traceback
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.core.mail import send_mail from django.core.mail import send_mail
from django.db import transaction from django.db import transaction
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from nsupdate.main.models import Host from nsupdate.main.models import Host
from nsupdate.utils.mail import translate_for_user, send_mail_to_user from nsupdate.utils.mail import translate_for_user, send_mail_to_user

View File

@ -7,7 +7,7 @@ from datetime import datetime
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db import transaction from django.db import transaction
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from nsupdate.main.models import Host from nsupdate.main.models import Host
from nsupdate.utils.mail import translate_for_user, send_mail_to_user from nsupdate.utils.mail import translate_for_user, send_mail_to_user

View File

@ -8,7 +8,7 @@ from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db import transaction from django.db import transaction
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from nsupdate.main.models import Host, Domain from nsupdate.main.models import Host, Domain

View File

@ -3,7 +3,7 @@ top-level url dispatching
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls import include, url from django.urls import include, re_path
from django.contrib import admin from django.contrib import admin
from django.contrib.auth import login from django.contrib.auth import login
from django.conf.urls.static import static from django.conf.urls.static import static
@ -24,21 +24,21 @@ def remember_me_login(request, *args, **kw):
urlpatterns = [ urlpatterns = [
url('', include('social_django.urls', namespace='social')), re_path('', include('social_django.urls', namespace='social')),
url(r'^accounts/', include('nsupdate.login.urls')), re_path(r'^accounts/', include('nsupdate.login.urls')),
# registration and user settings # registration and user settings
url(r'^account/', include('nsupdate.accounts.urls')), re_path(r'^account/', include('nsupdate.accounts.urls')),
# https://wicg.github.io/change-password-url/index.html # https://wicg.github.io/change-password-url/index.html
url(r'^.well-known/change-password$', RedirectView.as_view(pattern_name='account_settings', permanent=False)), re_path(r'^.well-known/change-password$', RedirectView.as_view(pattern_name='account_settings', permanent=False)),
url(r'^admin/', include((admin.site.get_urls(), 'admin'), namespace='admin')), re_path(r'^admin/', include((admin.site.get_urls(), 'admin'), namespace='admin')),
url(r'^i18n/', include('django.conf.urls.i18n')), re_path(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^', include('nsupdate.main.urls')), re_path(r'^', include('nsupdate.main.urls')),
] ]
if settings.DEBUG: if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
import debug_toolbar import debug_toolbar
urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls)), ] urlpatterns += [re_path(r'^__debug__/', include(debug_toolbar.urls)), ]
# we have expensive context processors and do not want to invoke them for the # we have expensive context processors and do not want to invoke them for the

View File

@ -3,7 +3,7 @@ Tests for mail module.
""" """
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from ..mail import translate_for_user from ..mail import translate_for_user