renderers in Django Rest Framework

renderers in Django Rest Framework
Renderers are used to serialize the response into a specific media type like JSON, XML, YAML, etc. Django REST Framework provides various built-in renderer classes and it also supports to write a custom renderer. We specify renderers as an iterable type (i.e tuple, list, set, etc.). It means we can use multiple renderers for a single view/viewset.

Read more

parsers in Django Rest Framework

parsers in Django Rest Framework
Parsers in Django REST are used to parse the content of incoming HTTP request. In HTTP request we recieve the data as a string format. Parsers will parse the HTTP contetns in to python data types based on the Content-Type header recieved in the HTTP request. Django REST Framework provides a number of built-in parsers which parses different types of

Read more

routers in Django Rest Framework

routers in Django Rest Framework
Routers are used with ViewSets in django rest framework to auto config the urls. Routers provides a simple, quick and consistent way of wiring ViewSet logic to a set of URLs. Router automatically maps the incoming request to proper viewset action based on the request method type(i.e GET, POST, etc). Let's start using routers. Working with DRF Route

Read more

viewsets in Django Rest Framework

viewsets in Django Rest Framework
ViewSets are one of the super cool features of Django REST Framework. ViewSets are just a type of class based view but it do not provide request method handlers like "get()", "post()", "patch()", "delete()", etc. But, it provides actions such as "create()", "list()", "retrieve()", "update()", "partial_update()" and "destroy()". DRF allows us to com

Read more

permissions in Django Rest Framework

permissions in Django Rest Framework
Permissions in Django Rest Framework are used to grant or deny access for different types of users to different parts of the API. Permissions are very useful when serving API resources/end-points with certain restrictions. For example, let's consider you are writing an api endpoint to create an answer to a question just like stackoverflow. It only

Read more

authentication in Django Rest Framework

authentication in Django Rest Framework
In previous articles we have developed an open API i.e any user (Authenticated and Un-authenticated) can access the API resource. If we want to want to know the information who is accessing the API then we have to autheticate the user. Authentication means the process or action of verifying the identity of a user. REST framework provides a number o

Read more

advanced class based views in Django Rest Framework

advanced class based views in Django Rest Framework
Django Rest Framework is super awesome to create an web API very quickly. It provides generic views to implement the common functionality. In the previous section we have discussed about class based views in Django REST. Django REST class based views allows us to create an api endpoint with a single request method type i.e one of "GET", "POST", "PU

Read more

class based views in Django Rest Framework

class based views in Django Rest Framework
Django Rest Framework supports both function and class based views. I personally prefer class based views upon function-based views. Because most of the common functionality was already implemented in the the class based views. so, why to write it again we can simply use it. It's always a better approach to keep our code DRY. In DRF we have a class

Read more

model serializers in Django Rest Framework

model serializers in Django Rest Framework
Model serializers in django rest framework are very similar to the django model forms. By using the model serializers we can reduce the effort of writing the more code for serializers. Model serializers are the shortcuts that allow us to automatically create a serializer with fields that associated with the resective model. Model serializer class i

Read more

serializers in Django Rest Framework

serializers in Django Rest Framework
Serializers in django rest framework are similar to django forms. By using django rest framework serializers we can serialize and deserialize the data. We can also validate the incoming data using django rest framework serializers to maintain the integrity of the data. We can divide the django rest framework serializers into two categories. Normal

Read more

getting started with Django Rest Framework

getting started with Django Rest Framework
Before we get started with django rest framework we need to have the basic knowledge of python, django and how to work with RESTful API's. Django Rest Framework was developed by Tom Christe. It is one of the worlds leading API development frameworks. Django REST Framework is a open-source software and it is used by worlds best companies including M

Read more

Introduction to RESTful api's

Introduction to RESTful api's
REST(Representational state transfer) is a one of the architectural(designed with some specific rules and regulations) ways to transfer the data by using the HTTP protocol. In this article we will learn what are the restful api's and why we use it.we'll understand api request format and request methods in REST api's and it's usage. Why we use REST

Read more

Support Me on Patreon
Blog Archive