Skip to content

Browsable API crashes on extra action in viewset. #6855

@sanchaz

Description

@sanchaz

Checklist

  • [ X ] I have verified that that issue exists against the master branch of Django REST framework.
  • [ X ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [ X ] This is not a usage question. (Those should be directed to the discussion group instead.)
  • [ X ] This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • [ X ] I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

Please see my example project https://github.com/sanchaz/django-drf-demo
clone
./manage migrate
./manage test
./manage runserver
Go to http://127.0.0.1:8000/admin
Login with
user: demo
password: demo
Go to http://127.0.0.1:8000/api/demo/thisone/demo2/
Go to http://127.0.0.1:8000/api/demo/thisone/demo/

Expected behavior

http://127.0.0.1:8000/api/demo/thisone/demo/ should instead show the data.

The tests written call endpoint demo/ and demo2/ without any issue.
demo2/ is the same as demo/ but the serializer is passed an array instead of an object and many=True

Actual behavior

Crashes because it tries to check for object permission on the serializer object used in the Response.

This seems like a bug in the browsable api.
I don't understand why it calls check_object_permissions on the serializer obj used in the response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions