Skip to content

Commit

Permalink
⚰️ Remove obsolete shim
Browse files Browse the repository at this point in the history
The import shim was required for Django versions pre 3.0,
but this library requires at least Django 3.2.
  • Loading branch information
sergei-maertens committed Sep 24, 2023
1 parent 5c21c4b commit 2c90289
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 1 addition & 6 deletions cookie_consent/compat.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
try:
from django.utils.http import url_has_allowed_host_and_scheme
except ImportError: # django < 3.0
from django.utils.http import is_safe_url as url_has_allowed_host_and_scheme

try: # django >= 4.1
from django.contrib.auth.views import RedirectURLMixin
except ImportError:
from django.contrib.auth.views import (
SuccessURLAllowedHostsMixin as RedirectURLMixin,
)

__all__ = ["url_has_allowed_host_and_scheme", "RedirectURLMixin"]
__all__ = ["RedirectURLMixin"]
3 changes: 2 additions & 1 deletion cookie_consent/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
from django.middleware.csrf import get_token as get_csrf_token
from django.urls import reverse
from django.utils.http import url_has_allowed_host_and_scheme
from django.views.generic import ListView, View

from .compat import RedirectURLMixin, url_has_allowed_host_and_scheme
from .compat import RedirectURLMixin
from .models import CookieGroup
from .util import (
accept_cookies,
Expand Down

0 comments on commit 2c90289

Please sign in to comment.