I'm not sure how to implement a redirect to login if the user is doesn't meet the permissions criteria, as the documentation states: "Before running the main body of the view each permission in the list is checked." - so overriding methods in the view is fruitless. If anyone could point me in the right direction? Thanks!
相关问题
- Django __str__ returned non-string (type NoneType)
- Django & Amazon SES SMTP. Cannot send email
- Django check user group permissions
- Django restrict pages to certain users
- UnicodeEncodeError with attach_file on EmailMessag
相关文章
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- Serialise choice text for IntegerField with choice
- Django is sooo slow? errno 32 broken pipe? dcramer
- Django: Replacement for the default ManyToMany Wid
- Upgrading transaction.commit_manually() to Django
Django Rest Framework is a toolkit to build web APIs. It doesn't render pages filled with content - it just serializes and sends the information which you requested. And in case you don't have the permission to access a resource on server, DRF sends you either a
401 Unauthorized
status, or a403 Forbidden
status responses.In order to redirect a user to the login page, you should do this in the frontend, after receiving a
401
status, which means that the user is not authenticated.