diff options
| author | BrickXu | 2014-12-02 12:55:34 +0800 |
|---|---|---|
| committer | xulei | 2014-12-02 17:07:55 +0800 |
| commit | 53f52765fc90472a05cbeb34760b45f735a7332c (patch) | |
| tree | fa23ccefecb526c71e99d404ca3906be6e5ca04b /rest_framework/viewsets.py | |
| parent | 81870b6e1a7b0c3c149d4bfba0e20924ebf1b187 (diff) | |
| download | django-rest-framework-53f52765fc90472a05cbeb34760b45f735a7332c.tar.bz2 | |
Not allow to pass an empty actions to viewset.as_view(). Refs issue #2171
Diffstat (limited to 'rest_framework/viewsets.py')
| -rw-r--r-- | rest_framework/viewsets.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rest_framework/viewsets.py b/rest_framework/viewsets.py index 84b4bd8d..70d14695 100644 --- a/rest_framework/viewsets.py +++ b/rest_framework/viewsets.py @@ -48,6 +48,12 @@ class ViewSetMixin(object): # eg. 'List' or 'Instance'. cls.suffix = None + # actions must not be empty + if not actions: + raise TypeError("The `actions` argument must be provided when " + "calling `.as_view()` on a ViewSet. For example " + "`.as_view({'get': 'list'})`") + # sanitize keyword arguments for key in initkwargs: if key in cls.http_method_names: |
