Type Error on APIView permission classes
vince015 opened this issue · 1 comments
vince015 commented
Describe the bug
I am getting the following error:
File "/****/profile.py", line 62, in ProfileDetail
permission_classes = [HasAPIKey | IsAuthenticated]
TypeError: unsupported operand type(s) for |: 'type' and 'type'
To Reproduce
Steps to reproduce the behavior:
- Update permission class on a view
settings.py
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework_api_key.permissions.HasAPIKey'
),
views
class ProfileDetail(APIView):
permission_classes = [HasAPIKey | IsAuthenticated]
- run python manage.py runserver
- See error
Expected behavior
No error
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: macOS
- Version: 10.15.7
- Python Version: 3.7
- Django Version: 2.0
- DRF Version: 3.7.3
florimondmanca commented
Hi @vince015,
Seems like you'd need to upgrade your DRF version to use the &
/ |
functionality, as it was introduced in DRF 3.9. See DRF 3.9 announcement.
Closing this for now, but if upgrading does not fix it, feel free to reach back!
Thanks