I am trying to build a GET and POST method to get and save some objects.
I have views.py like this
class QuestionList(generics.ListAPIView):
queryset = Question.objects.all()
serializer_class = QuestionSerializer
class QuestionSave(generics.CreateAPIView):
queryset = Question.objects.all()
serializer_class = QuestionSerializer
Then I have url conf, urls.py like this
urlpatterns = [
url(r'^questions/$',views.QuestionList.as_view())
]
In my understanding, we have to have a generic class with CreateApiView for POST methods and ListApiView for GET method and so I have created classes like that.
My question is, how should I configure them so that on POST QuestionSave will be called and on GET QuestionList will be called?
QuestionList(generics.ListAPIView, generics.CreateAPIView)?