mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Amend ViewSet docs to warn of potential problem
I went through this exact problem and so thought the docs might benefit from a small hint at the appropriate point.
This commit is contained in:
parent
71c49fea8a
commit
9b468fba60
|
@ -201,6 +201,8 @@ Note that you can use any of the standard attributes or method overrides provide
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return self.request.user.accounts.all()
|
return self.request.user.accounts.all()
|
||||||
|
|
||||||
|
Note however that upon removal of the `queryset` property from your `ViewSet`, any associated [router][routers] will be unable to derive the base_name of your Model automatically, and so you you will have to specify the `base_name` kwarg as part of your [router registration][routers].
|
||||||
|
|
||||||
Also note that although this class provides the complete set of create/list/retrieve/update/destroy actions by default, you can restrict the available operations by using the standard permission classes.
|
Also note that although this class provides the complete set of create/list/retrieve/update/destroy actions by default, you can restrict the available operations by using the standard permission classes.
|
||||||
|
|
||||||
## ReadOnlyModelViewSet
|
## ReadOnlyModelViewSet
|
||||||
|
@ -243,3 +245,4 @@ To create a base viewset class that provides `create`, `list` and `retrieve` ope
|
||||||
By creating your own base `ViewSet` classes, you can provide common behavior that can be reused in multiple viewsets across your API.
|
By creating your own base `ViewSet` classes, you can provide common behavior that can be reused in multiple viewsets across your API.
|
||||||
|
|
||||||
[cite]: http://guides.rubyonrails.org/routing.html
|
[cite]: http://guides.rubyonrails.org/routing.html
|
||||||
|
[routers]: routers.md
|
||||||
|
|
Loading…
Reference in New Issue
Block a user