To retrieve a particular object in your API you should implement it in a method called "retrieve", not "get", if I remember correctly
On Tue, Sep 5, 2017 at 10:28 AM, Rakhee Menon <menonrakhee15@gmail.com> wrote:
--CODE:class FormList(APIView):def get(self, request, id):import ipdb;ipdb.set_trace()item_obj = ItemMaster.objects.get(id=id)serializer = ItemMasterSerializer(forms,many =False)return Response(serializer.data, content_type="application/json" )def get(self,request):forms = ItemMaster.objects.all()serializer=ItemMasterSerializer(forms,man y =True)return Response(serializer.data, content_type="application/json" )I get this error.django-got-an-unexpected-keyword-argument- id. when i try to access a specific item..Please can anyone suggest how to solve this bug using APIViews and not by using viewset as there is lot of customization in my API.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8f1a1edf- .ed7f-490f-8c29-73aa31531a3b% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei3fp0uWeBr0a6ycGvw03ZKqzXRdepJpD%2B34VKxTQV-4hQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment