master branch of Django REST framework.self.request.API docs page should render
Error 'NoneType' object has no attribute 'user'
traceback
self.request is None
This issue also persists in another variation.
'NoneType' object has no attribute 'items'
I experience the same issue as @scriptonist. I'm not sure though if it is related to the original issue...
This is what I have found so far:
'NoneType' object has no attribute 'items' appears.I managed to trace it to the following setting:
python
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
}
If I comment out the line: 'rest_framework.permissions.IsAuthenticated',, the docs endpoint works as expected.
Recently switched to 3.6 to try to implement the new coreapi goodnesses. I am experiencing the same issues, more generally I think it would be nice to have some technical infos about how the documentation is generated.
I customized a lot my viewsets to avoid redundant code (dynamic serializers fields and class, dynamic querysets,) using the request context (type of user, action, etc). And it seems these info are not available when generating the doc.
My assumption is DRF is cycling through all available actions but without request, but this would help to get more info about how this is done in the next release.
@Kiougar still not working for me
I have restful version 3.6.3
and get error 'NoneType' object has no attribute 'items'
link to code where error appears {% for link_key, link in section.links|items %}
Same issue. Latest DRF, Python 3.6.1.
My Viewsets are accessing self.request.user. Even when I'm logged in, docs page raises an error:
'NoneType' object has no attribute 'user'
There's no point in adding additional comments that you face the issue. It's been reported already.
The next steps here would be to add a failing test case to DRF's test suite and then work on a fix.
Any volunteer around ?
I can confirm the error exists for include_docs_urls(Public=True) on DRF version 3.6.3 when not authenticated and IsAuthenticated permissions are set
3.6.4 fixed it on my side.
This is basically the same issue as #5142.
request=None — since the default get_docs_view sets public=True include_docs_urls to configure the view as you want it.(I'll leave this open just for now to make sure we capture the different aspects here.)
Still persists,
Python : 3.6
Django 2.0
DRF 3.8.2
On Accessing /docs/ as described here , faced the same above issue.
Most helpful comment
I experience the same issue as @scriptonist. I'm not sure though if it is related to the original issue...
This is what I have found so far:
'NoneType' object has no attribute 'items'appears.I managed to trace it to the following setting:
python REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), }If I comment out the line:
'rest_framework.permissions.IsAuthenticated',, the docs endpoint works as expected.