Ok, I have a CreateView. The process I have now is: blank form is created by CreateView After I submit the data to the form, I have a post_save that calls a function that queries the API based on the values entered in the form.
When and how do I call the serializer during this process? On Friday, September 2, 2022 at 3:15:00 AM UTC-4 [email protected] wrote: > Hello , > > You can design a serializer for each api endpoint and use it in your view > to validate your data like validating forms data : > Pseducode : > res = requests.post(url+some_endpoint, data) > endpoint_serializer.validate(res.data) > if serializer.is_valid(): > #do your stuff > else : > #do something > > Best Regards > > Ammar Mohammed > > On Fri, 2 Sep 2022, 01:41 [email protected], <[email protected]> wrote: > >> Hello all, >> >> I am sending an GET request to an external API and I would like to >> validate the response before I save it to my model. How do I do this? >> >> Thank you. >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0e1c1af9-f423-4e3a-ba62-55cc60efd8c5n%40googlegroups.com.

