admindocs.views.view_index dies when views are callable classes
Reported by: |
Matthew Flanagan <mattimustang@…> |
Owned by: |
nobody |
Component:
|
Contrib apps
|
Version:
|
1.0
|
Severity:
|
|
Keywords:
|
admindocs
|
Cc:
|
|
Triage Stage:
|
Accepted
|
Has patch:
|
yes
|
Needs documentation:
|
no
|
Needs tests:
|
no
|
Patch needs improvement:
|
no
|
Easy pickings:
|
no
|
UI/UX:
|
no
|
I'm using django_restapi and the django.contrib.admindocs Views listing dies with the traceback:
Traceback:
File "/home/mflanaga/src/nong/vendor/django/django/core/handlers/base.py" in get_response
86. response = callback(request, *callback_args, **callback_kwargs)
File "/home/mflanaga/src/nong/vendor/django/django/contrib/admin/views/decorators.py" in _checklogin
33. return view_func(request, *args, **kwargs)
File "/home/mflanaga/src/nong/vendor/django/django/contrib/admindocs/views.py" in view_index
131. 'name': func.__name__,
Exception Type: AttributeError at /admin/docs/views/
Exception Value: 'Collection' object has no attribute '__name__'
This is because the Collection instance is callable rather than being a plain view function. I've attached a patch that fixes this.
fix for callable classes