Skip to content Skip to sidebar Skip to footer

Class-based View "has No Attribute .as_view()" Error

I'm following this tutorial, trying to make an API for my Products table. Here's my .views/API/apitest.py view: from my_app.views.API.serializers import ProductSerializer from my_a

Solution 1:

apitest is the module, you need to use as_view on the class

url(r'^API/products/$', views.API.apitest.APITest.as_view(), name='apitest')

Although it may be better to look into your imports

from myapp.views.API.apitest import APITest
url(r'^API/products/$', APITest.as_view(), name='apitest')

Post a Comment for "Class-based View "has No Attribute .as_view()" Error"