forms/models can be set on the view as well as the resource

This commit is contained in:
Tom Christie 2011-05-27 10:35:43 +01:00
parent cefc6a25c2
commit 9e9ae60949

View File

@ -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)