Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

BrickXu
Copy link
Contributor

@BrickXu BrickXu commented Dec 2, 2014

Validate actions value when invoke as_view(), raise a TypeError if no actions was passed in.

Refs #2171

@BrickXu
Copy link
Contributor Author

BrickXu commented Dec 2, 2014

Also add unittest for viewset.as_view()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

METHOD is a confusing string to use here, as it could mean the request method. ACTION would be more descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

lovelydinosaur added a commit that referenced this pull request Dec 3, 2014
Not allow to pass an empty actions to viewset.as_view()
@lovelydinosaur lovelydinosaur merged commit c5a2d50 into encode:master Dec 3, 2014
@lovelydinosaur
Copy link
Contributor

Thanks!

@gitaarik
Copy link

Not sure, but I was following the documentation about testing and got this exception

The actions argument must be provided when calling .as_view() on a ViewSet. For example .as_view({'get': 'list'})

So, should the documentation be updated to add this actions argument?

http://www.django-rest-framework.org/api-guide/testing/#forcing-authentication

@xordoquy
Copy link
Contributor

AccountDetail isn't a viewset so it doesn't have any use of the actions

@gitaarik
Copy link

Ah yeah, of course, sometimes all the different kind of views are confusing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants