i want to delete and edit notes in my django app, but i am struck on this error for long Error : \"TypeError at /delete/1/ Field \'id\' expected a number but got .
Please see this answer if you were playing with API(Rest Framework of Django)
I got this error and I solved it by changing True
to False
while serializing the object.
@api_view(['GET'])
def event_detail(request, pk):
try:
event = Event.objects.get(id=pk)
# This is the line I have made changes True to False.
serializer = EventSerializer(event, many=False)
return Response(serializer.data)
except:
return render(request, "404_page.html")