https://www.django-rest-framework.org/api-guide/serializers/#dealing-with-multiple-objects
You specify many=True in the serializer constructor; hence the serializer expects a list of objects. You provide a single object; hence you get an error about argument not being iterable. On Wed, Nov 4, 2020 at 1:32 AM Ashutosh Mishra <ashutoshmishra...@gmail.com> wrote: > I want to fetch a particular entry by using primary key,suppose if I put 1 > the entry associated with 1 will appear > > On Wed 4 Nov, 2020, 12:01 Xavier Ordoquy, <xordo...@linovia.com> wrote: > >> The question is, what are you trying to do and what outcome are you >> expecting ? >> >> Le 4 nov. 2020 à 07:28, Ashutosh Mishra <ashutoshmishra...@gmail.com> a >> écrit : >> >> So how can I resolve this? >> >> On Wed 4 Nov, 2020, 11:56 Xavier Ordoquy, <xordo...@linovia.com> wrote: >> >>> Hi, >>> >>> Please, paste your code in the mail instead of screenshots, it makes it >>> hard to read. >>> In your view, you are passing an Article instance to your serializer >>> along with the many=True keyword which means the serializer will expect an >>> iterable of Articles as the error suggests. >>> >>> Regards, >>> Xavier O. >>> Linovia. >>> >>> >>> Le 4 nov. 2020 à 07:03, Ashutosh Mishra <ashutoshmishra...@gmail.com> a >>> écrit : >>> >>> whenever i try to fetch data usinng primary key,getting above error >>> models.py >>> <Screenshot from 2020-11-04 11-31-06.png> >>> >>> serializer.py >>> <Screenshot from 2020-11-04 11-31-13.png> >>> >>> view.py >>> <Screenshot from 2020-11-04 11-31-19.png> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django REST framework" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-rest-framework+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-rest-framework/75f76a91-52ed-4cde-887c-26998ab2fe04n%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-rest-framework/75f76a91-52ed-4cde-887c-26998ab2fe04n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> <Screenshot from 2020-11-04 11-31-19.png><Screenshot from 2020-11-04 >>> 11-31-13.png><Screenshot from 2020-11-04 11-31-06.png> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Django REST framework" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/django-rest-framework/2M7lfY2wlZc/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> django-rest-framework+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-rest-framework/4A8683CF-1ACA-4A39-87FC-8254C35C98ED%40linovia.com >>> <https://groups.google.com/d/msgid/django-rest-framework/4A8683CF-1ACA-4A39-87FC-8254C35C98ED%40linovia.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django REST framework" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-rest-framework+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-rest-framework/CAGDmY655NCS_o3wxOCbHam4nYFAbG0o80Auf_%2BeTVBQUaxL6-Q%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-rest-framework/CAGDmY655NCS_o3wxOCbHam4nYFAbG0o80Auf_%2BeTVBQUaxL6-Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Django REST framework" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/django-rest-framework/2M7lfY2wlZc/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> django-rest-framework+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-rest-framework/9255A349-262F-4876-9429-4E1FA8E4543D%40linovia.com >> <https://groups.google.com/d/msgid/django-rest-framework/9255A349-262F-4876-9429-4E1FA8E4543D%40linovia.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django REST framework" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-rest-framework+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-rest-framework/CAGDmY66st70MbECYMyFPYK-t2UZSEtPrgZ1q3yOMwJ3euEchsA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-rest-framework/CAGDmY66st70MbECYMyFPYK-t2UZSEtPrgZ1q3yOMwJ3euEchsA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAB-99LsuwT%2B0Lrji10TPYa6LDFDv224fr4C%3DvSmMSLRHs28MWA%40mail.gmail.com.