diff options
author | Filipp Lepalaan <filipp@mac.com> | 2021-05-12 20:58:01 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2021-05-12 20:58:01 +0300 |
commit | 64babb6918fe038e8a94353117fb869e4db41f02 (patch) | |
tree | 17a5e1cb0213322191eee268b7e0344ac171324f | |
parent | 9326a6be300577965f7378bffbf6771240f52ad5 (diff) | |
download | Servo-64babb6918fe038e8a94353117fb869e4db41f02.tar.gz Servo-64babb6918fe038e8a94353117fb869e4db41f02.tar.bz2 Servo-64babb6918fe038e8a94353117fb869e4db41f02.zip |
Django 3 fixes
-rw-r--r-- | servo/forms/checkin.py | 4 | ||||
-rw-r--r-- | servo/lib/middleware.py | 2 | ||||
-rw-r--r-- | servo/views/checkin.py | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/servo/forms/checkin.py b/servo/forms/checkin.py index 8cd19c4..c8429a9 100644 --- a/servo/forms/checkin.py +++ b/servo/forms/checkin.py @@ -28,7 +28,7 @@ YEARS = [x + 1 for x in range(y - 10, y)] def get_checkin_locations(user): """Return possible checkin location choices for this user.""" from servo.models import User - if user.is_authenticated(): + if user.is_authenticated: return user.locations.enabled() else: user_id = Configuration.conf('checkin_user') @@ -196,7 +196,7 @@ class CustomerForm(forms.Form): self.fields['checkout_location'].queryset = locations self.fields['checkout_location'].initial = location - if request.user.is_authenticated(): + if request.user.is_authenticated: del(self.fields['agree_to_terms']) self.fields['phone'].widget = SearchFieldInput() diff --git a/servo/lib/middleware.py b/servo/lib/middleware.py index 89675e1..6549e6a 100644 --- a/servo/lib/middleware.py +++ b/servo/lib/middleware.py @@ -33,7 +33,7 @@ class LoginRequiredMiddleware: 'django.contrib.auth.middlware.AuthenticationMiddleware'. If that doesn't\ work, ensure your TEMPLATE_CONTEXT_PROCESSORS setting includes\ 'django.core.context_processors.auth'." - if request.user.is_authenticated() == False: + if request.user.is_authenticated == False: path = request.path_info.lstrip('/') if any(m.match(path) for m in EXEMPT_URLS) == False: return HttpResponseRedirect(settings.LOGIN_URL) diff --git a/servo/views/checkin.py b/servo/views/checkin.py index 1a8256a..0c83201 100644 --- a/servo/views/checkin.py +++ b/servo/views/checkin.py @@ -44,7 +44,7 @@ def find_device(request): def find_customer(request, phone): - if not request.user.is_authenticated(): + if not request.user.is_authenticated: raise PermissionDenied results = [] @@ -116,7 +116,7 @@ def init_session(request): Only run for GET requests """ - if not request.user.is_authenticated(): + if not request.user.is_authenticated: request.session.flush() if not Configuration.checkin_enabled(): |