mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 12:17:24 +03:00
forms/models can be set on the view as well as the resource
This commit is contained in:
parent
cefc6a25c2
commit
9e9ae60949
|
@ -410,9 +410,9 @@ class ResourceMixin(object):
|
||||||
def _resource(self):
|
def _resource(self):
|
||||||
if self.resource:
|
if self.resource:
|
||||||
return self.resource(self)
|
return self.resource(self)
|
||||||
elif hasattr(self, 'model'):
|
elif getattr(self, 'model', None):
|
||||||
return ModelResource(self)
|
return ModelResource(self)
|
||||||
elif hasattr(self, 'form'):
|
elif getattr(self, 'form', None):
|
||||||
return FormResource(self)
|
return FormResource(self)
|
||||||
return Resource(self)
|
return Resource(self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user