mirror of
https://github.com/Hopiu/django-tos.git
synced 2026-03-16 20:10:24 +00:00
2.6 format compat
This commit is contained in:
parent
b826c969ad
commit
cfc6615690
1 changed files with 3 additions and 3 deletions
|
|
@ -46,11 +46,11 @@ class UserAgreementMiddleware(deprecation.MiddlewareMixin if DJANGO_VERSION >= (
|
|||
|
||||
# Skip if the user is allowed to skip - for instance, if the user is an
|
||||
# admin or a staff member
|
||||
if cache.get('django:tos:skip_tos_check:{}'.format(str(user_id)), False, version=key_version):
|
||||
if cache.get('django:tos:skip_tos_check:{0}'.format(str(user_id)), False, version=key_version):
|
||||
return None
|
||||
|
||||
# Ping the cache for the user agreement
|
||||
user_agreed = cache.get('django:tos:agreed:{}'.format(str(user_id)), None, version=key_version)
|
||||
user_agreed = cache.get('django:tos:agreed:{0}'.format(str(user_id)), None, version=key_version)
|
||||
|
||||
# If the cache is missing this user
|
||||
if user_agreed is None:
|
||||
|
|
@ -60,7 +60,7 @@ class UserAgreementMiddleware(deprecation.MiddlewareMixin if DJANGO_VERSION >= (
|
|||
terms_of_service__active=True).exists()
|
||||
|
||||
# Set the value in the cache
|
||||
cache.set('django:tos:agreed:{}'.format(user_id), user_agreed, version=key_version)
|
||||
cache.set('django:tos:agreed:{0}'.format(user_id), user_agreed, version=key_version)
|
||||
|
||||
if not user_agreed:
|
||||
# Confirm view uses these session keys. Non-middleware flow sets them in login view,
|
||||
|
|
|
|||
Loading…
Reference in a new issue