When i do the following command over Terminal using curl
curl -X POST http://myuser:[email protected]:8000/call/make-call/ -d "tutor=1&billed=1"
I get the following error
AssertionError at /call/make-call/ Expected a
Response,HttpResponseorHttpStreamingResponseto be returned from the view, but received a<type 'NoneType'>
My views.py is
@api_view(['GET', 'POST'])
def startCall(request):
if request.method == 'POST':
serializer = startCallSerializer(data=request.DATA)
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
else:
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
my serializer.py is
class startCallSerializer(serializers.ModelSerializer):
class Meta:
model = call
fields = ('tutor', 'billed', 'rate', 'opentok_sessionid')
my urls.py is
urlpatterns = patterns(
'api.views',
url(r'^call/make-call/$','startCall', name='startCall'),
)