Django REST
About Lesson

In this Django REST Framework lesson we are going to learn about Django REST Framework Model Serializer, as in the previous lesson we have created our ArticleSerializer, but our ArticleSerializer  class is replicating a lot of information that’s also contained in the Article model. It would be nice if we could keep our code a bit more concise. In the same way that Django provides both Form classes and ModelForm classes, REST framework includes both Serializer classes, and ModelSerializer classes.

 

 

Let’s look at refactoring our serializer using the ModelSeriaizer class.

 

 

Now you can see that how easily we have created our ModelSerializer.

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found