Conversation
f1fff24
to
6ca3372
Compare
6ca3372
to
ec63d17
Compare
@lambdalisue Please Review 🙏 |
src/permission/compat.py
Outdated
@@ -26,6 +26,19 @@ def isiterable(x): | |||
except ImportError: | |||
from django.utils.importlib import import_module | |||
|
|||
if django.VERSION >= (1, 11): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The is_authenticated
and is_anonymous
has become attributes from Django 1.10 (internally, it is a property which returns a callable boolean for backward compatibility ref)
So the line should be the following even if the method style is supported in Django 1.10
if django.VERSION >= (1, 10):
src/permission/compat.py
Outdated
@@ -26,6 +26,19 @@ def isiterable(x): | |||
except ImportError: | |||
from django.utils.importlib import import_module | |||
|
|||
if django.VERSION >= (1, 11): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unusual condition should be in a IF block. I meant the code should be
if django.VERSION < (1, 10):
# For backward compatibility
...
else:
# This is a default way
...
src/permission/compat.py
Outdated
@@ -26,6 +26,19 @@ def isiterable(x): | |||
except ImportError: | |||
from django.utils.importlib import import_module | |||
|
|||
if django.VERSION >= (1, 11): | |||
def is_authenticated(u): | |||
return u.is_authenticated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use user
or user_obj
instead of u
.
Thanks 👍 |
closes #70 closes #71