Closes #1842: Implement support for Django 2.0
This commit is contained in:
@@ -33,7 +33,7 @@ class IsAuthenticatedOrLoginNotRequired(BasePermission):
|
||||
def has_permission(self, request, view):
|
||||
if not settings.LOGIN_REQUIRED:
|
||||
return True
|
||||
return request.user.is_authenticated()
|
||||
return request.user.is_authenticated
|
||||
|
||||
|
||||
#
|
||||
|
@@ -325,7 +325,7 @@ class CSVChoiceField(forms.ChoiceField):
|
||||
"""
|
||||
|
||||
def __init__(self, choices, *args, **kwargs):
|
||||
super(CSVChoiceField, self).__init__(choices, *args, **kwargs)
|
||||
super(CSVChoiceField, self).__init__(choices=choices, *args, **kwargs)
|
||||
self.choices = [(label, label) for value, label in choices]
|
||||
self.choice_values = {label: value for value, label in choices}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class LoginRequiredMiddleware(object):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
if LOGIN_REQUIRED and not request.user.is_authenticated():
|
||||
if LOGIN_REQUIRED and not request.user.is_authenticated:
|
||||
# Redirect unauthenticated requests to the login page. API requests are exempt from redirection as the API
|
||||
# performs its own authentication.
|
||||
api_path = reverse('api-root')
|
||||
|
Reference in New Issue
Block a user