aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/mixins.py
diff options
context:
space:
mode:
authorTom Christie2011-05-23 17:07:31 +0100
committerTom Christie2011-05-23 17:07:31 +0100
commitc53175914752502629141556f3e001e9d2e9f7fa (patch)
treed68bc4f0b2baeed2a90d6d20295423583603ba2b /djangorestframework/mixins.py
parente7f8c06dbbbc9e4ae91327ee02cd8147777b17e2 (diff)
downloaddjango-rest-framework-c53175914752502629141556f3e001e9d2e9f7fa.tar.bz2
name and description
Diffstat (limited to 'djangorestframework/mixins.py')
-rw-r--r--djangorestframework/mixins.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/djangorestframework/mixins.py b/djangorestframework/mixins.py
index 73ffbec2..62257592 100644
--- a/djangorestframework/mixins.py
+++ b/djangorestframework/mixins.py
@@ -467,12 +467,13 @@ class InstanceMixin(object):
Store the callable object on the resource class that has been associated with this view.
"""
view = super(InstanceMixin, cls).as_view(**initkwargs)
- if 'resource' in initkwargs:
+ resource = getattr(cls(**initkwargs), 'resource', None)
+ if resource:
# We do a little dance when we store the view callable...
# we need to store it wrapped in a 1-tuple, so that inspect will treat it
# as a function when we later look it up (rather than turning it into a method).
# This makes sure our URL reversing works ok.
- initkwargs['resource'].view_callable = (view,)
+ resource.view_callable = (view,)
return view