From 19d9942676d56fa9289d0a24ec2c52c23437cf07 Mon Sep 17 00:00:00 2001 From: "Philip Sargent (oconee)" Date: Thu, 9 Feb 2023 20:54:55 +0000 Subject: [PATCH] Django 3.0 deprecations removed --- core/TESTS/test_imports.py | 2 +- core/views/auth.py | 4 ++-- templates/menu.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py index 5ec62ee..570c1fb 100644 --- a/core/TESTS/test_imports.py +++ b/core/TESTS/test_imports.py @@ -108,7 +108,7 @@ class SimpleTest(SimpleTestCase): def test_import_urls(self): from django.conf import settings - from django.conf.urls import include, url + #from django.conf.urls import include, url from django.contrib import admin, auth from django.urls import resolve, reverse from django.views.generic.base import RedirectView diff --git a/core/views/auth.py b/core/views/auth.py index 2257dd0..c4e78de 100644 --- a/core/views/auth.py +++ b/core/views/auth.py @@ -5,7 +5,7 @@ from django.contrib.auth import forms as auth_forms from django.contrib.auth import login, logout from django.contrib.auth.decorators import login_required from django.shortcuts import redirect, render -from django.utils.http import is_safe_url +from django.utils.http import url_has_allowed_host_and_scheme """This enforces the login requirement for non-public pages using the decorator mechanism. @@ -80,7 +80,7 @@ def redirect_after_login(request): nxt = request.GET.get("next", None) if nxt is None: return redirect(settings.LOGIN_REDIRECT_URL) - elif not is_safe_url(url=nxt, allowed_hosts={request.get_host()}, require_https=request.is_secure()): + elif not url_has_allowed_host_and_scheme(url=nxt, allowed_hosts={request.get_host()}, require_https=request.is_secure()): return redirect(settings.LOGIN_REDIRECT_URL) else: return redirect(nxt) diff --git a/templates/menu.html b/templates/menu.html index ef022b0..3014dce 100644 --- a/templates/menu.html +++ b/templates/menu.html @@ -26,9 +26,9 @@ {% else %} {{parent_cave.unofficial_number }} {{parent_cave.official_name|safe}} {% endif %} - {% ifequal parent_cave.kataster_number "161" %} + {% if parent_cave.kataster_number == "161" %}
  • KH Glossary
  • - {% endifequal %} + {% endif %} {% endfor %} {% endif%}