aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTom Christie2014-12-03 08:53:04 +0000
committerTom Christie2014-12-03 08:53:04 +0000
commitc5a2d501e56201c437118aa65004b33d20216b55 (patch)
tree6ac80f166d405ab3c4f0443b0f15bd6a574039f5 /rest_framework
parent71a8cb2282d2cb5cb92e74975f762bbdf8ff0d69 (diff)
parent53f52765fc90472a05cbeb34760b45f735a7332c (diff)
downloaddjango-rest-framework-c5a2d501e56201c437118aa65004b33d20216b55.tar.bz2
Merge pull request #2175 from BrickXu/fix_2171
Not allow to pass an empty actions to viewset.as_view()
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/viewsets.py6
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: