KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been trying for a while to get a ModelResource or a View working using the Django Rest Framework. I'm following the examples but the code in the examples is not working for me. Can anyone tell me why I might be getting this error. views.py # Create your views here. from django.http import HttpResponse from django.utils import simplejson from django.core import serializers from djangorestframework.views import View from djangorestframework.response import Response from djangorestframework import status from interface.models import * def TestView(View): def get(self, request): return Person.objects.all() urls.py from django.conf.urls.defaults import * from djangorestframework.resources import ModelResource from djangorestframework.views import ListOrCreateModelView, InstanceModelView, View from interface.models import * from interface.views import * class PersonResource(ModelResource): model = Person ordering = ('LastName') urlpatterns = patterns('', url(r'^$', 'interface.views.index'), url(r'^testview/$', TestView.as_view()), url(r'^people/$', ListOrCreateModelView.as_view(resource=PersonResource)), ) I'm now getting the error 'function' object has no attribute 'as_view'.
Tags (comma-separated)
Save Edits
Cancel