Creating Nested Objects | Overriding serializer create() method in Django REST Framework

Published: 27 December 2024
on channel: BugBytes
7,426
338

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes

⭐Top resource to learn Python - https://datacamp.pxf.io/kOjKkV ⭐

In this video, we'll learn how to create nested / related objects when sending POST/PUT requests in Django REST Framework. We'll show how to override the create() method on serializers, and how to dynamically pass data into serializers in generic views/viewsets.

Starter Code: https://github.com/bugbytes-io/drf-co...

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:45 Writing nested data in DRF overview
05:16 Creating serializer for Orders and OrderItems (POST requests)
08:40 Overriding get_serializer_class() to change serializer for POST requests
10:31 Overriding serializer create() method for nested data
16:56 Automatically setting user on POST requests

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/drf-co...

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
DRF Serializers: https://www.django-rest-framework.org...
Classy DRF: https://www.cdrf.co/

#python #django #webdevelopment #djangorestframework


On this page of the site you can watch the video online Creating Nested Objects | Overriding serializer create() method in Django REST Framework with a duration of hours minute second in good quality, which was uploaded by the user BugBytes 27 December 2024, share the link with friends and acquaintances, this video has already been watched 7,426 times on youtube and it was liked by 338 viewers. Enjoy your viewing!