mirror of
https://github.com/Hopiu/django-tos.git
synced 2026-03-16 20:10:24 +00:00
Update middleware.py
Use reverse_lazy instead of reverse, as reverse('tos_check_tos') can return the URL in a wrong language (the language the current thread is in, instead of the language of the users request) in combination with i18n.
This commit is contained in:
parent
b050ef76d3
commit
40fa4acdb4
1 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ from django.contrib.auth import SESSION_KEY as session_key
|
|||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.core.cache import caches
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.cache import add_never_cache_headers
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ from .models import UserAgreement
|
|||
|
||||
|
||||
cache = caches[getattr(settings, 'TOS_CACHE_NAME', 'default')]
|
||||
tos_check_url = reverse('tos_check_tos')
|
||||
tos_check_url = reverse_lazy('tos_check_tos')
|
||||
|
||||
|
||||
class UserAgreementMiddleware(MiddlewareMixin):
|
||||
|
|
|
|||
Loading…
Reference in a new issue