Adding Additional Fields to a ModelSerializer using SerializerMethodField (Django Rest framework)

preview_player
Показать описание

In this video I show you how to add extra fields to Serializers when using the django rest framework. I use something called s Serializer Method Field, which is part of the ModelSerializer class.

#djangorestframework #restapi

Рекомендации по теме
Комментарии
Автор

Many thanks, Mitch.
This video saved me after 4 hours of looking for a solution.

ayodele_great
Автор

I really really like the way you explain stuff, thank you so much for the AMAZING content

hamzasabri
Автор

thanks man. been stuck for hours trying to achieve this.

youshouldntbehere
Автор

where did "blog_post" come from?

tiger
Автор

are you able to use a SerializerMethod to also write to the model ?

Let's say you want to add to the blog_post model into title field something like: "username_and then the title"
Hence, you will send a json with all the blog_post data and the "username" field and then to have a way of taking the data from the "username" field and write it into blog_post title field.

bobocsabin
Автор

I'm sorry but where is the "blog_form" coming from again?

ivonherms
visit shbcf.ru