forked from expo/troggle
Django 3.0 deprecations removed
This commit is contained in:
parent
0740f9ea5a
commit
19d9942676
@ -108,7 +108,7 @@ class SimpleTest(SimpleTestCase):
|
|||||||
|
|
||||||
def test_import_urls(self):
|
def test_import_urls(self):
|
||||||
from django.conf import settings
|
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.contrib import admin, auth
|
||||||
from django.urls import resolve, reverse
|
from django.urls import resolve, reverse
|
||||||
from django.views.generic.base import RedirectView
|
from django.views.generic.base import RedirectView
|
||||||
|
@ -5,7 +5,7 @@ from django.contrib.auth import forms as auth_forms
|
|||||||
from django.contrib.auth import login, logout
|
from django.contrib.auth import login, logout
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.shortcuts import redirect, render
|
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
|
"""This enforces the login requirement for non-public pages using
|
||||||
the decorator mechanism.
|
the decorator mechanism.
|
||||||
@ -80,7 +80,7 @@ def redirect_after_login(request):
|
|||||||
nxt = request.GET.get("next", None)
|
nxt = request.GET.get("next", None)
|
||||||
if nxt is None:
|
if nxt is None:
|
||||||
return redirect(settings.LOGIN_REDIRECT_URL)
|
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)
|
return redirect(settings.LOGIN_REDIRECT_URL)
|
||||||
else:
|
else:
|
||||||
return redirect(nxt)
|
return redirect(nxt)
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{{parent_cave.unofficial_number }} {{parent_cave.official_name|safe}}</a>
|
{{parent_cave.unofficial_number }} {{parent_cave.official_name|safe}}</a>
|
||||||
{% endif %}</li>
|
{% endif %}</li>
|
||||||
{% ifequal parent_cave.kataster_number "161" %}
|
{% if parent_cave.kataster_number == "161" %}
|
||||||
<li><a href="/1623/161/names.htm">KH Glossary</a></li>
|
<li><a href="/1623/161/names.htm">KH Glossary</a></li>
|
||||||
{% endifequal %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif%}</li>
|
{% endif%}</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user