diff options
| author | Tom Christie | 2011-05-23 17:07:31 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-05-23 17:07:31 +0100 |
| commit | c53175914752502629141556f3e001e9d2e9f7fa (patch) | |
| tree | d68bc4f0b2baeed2a90d6d20295423583603ba2b /djangorestframework/mixins.py | |
| parent | e7f8c06dbbbc9e4ae91327ee02cd8147777b17e2 (diff) | |
| download | django-rest-framework-c53175914752502629141556f3e001e9d2e9f7fa.tar.bz2 | |
name and description
Diffstat (limited to 'djangorestframework/mixins.py')
| -rw-r--r-- | djangorestframework/mixins.py | 5 |
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 |
