How to create JSON objects with unique entries in Django REST Framework ?

This post is in continuation with “Writing class based Views in Django REST Framework” , for all related DRF posts, visit “Django REST Framework” page. When we are working with creating JSON objects for users using API, sooner we realised that we are can push the data with same “userid” for multiple times, and problem … Read more

How to customise API Root in Django REST Framework

Modify your projects settings.py ( helloproject/settings.py ) to know the BASE directory of the project You can print the BASE diretctory in python to know what is your directory, so you can adjust the theme directory for DRF to customise theme. Now, override the templates directory path by modifying TEMPLATES => DIRS in your projects … Read more

Why filters are required in Django REST Framework ?

We seen in our another post “Implementing filtering against query parameters for viewsets in DRF” , how to implement filters, but why these filters are actually required ? When we were trying to implement separating JSON objects based on “userid” and “username” using the object filters from views, it created following problem. We wanted the … Read more

Implementing filtering against query parameters for viewsets in DRF

filters

This post is related to / in continuation with “Writing class based Views in Django REST Framework” , you can also find all related articles at “Django and Django-REST Framework” page. You may also read “Why filters are required in Django REST Framework ?” if you are need to know in which situations filters will … Read more

Solved: TypeError: object is not iterable

When we were writing the filters for the Django REST framework to get JSON objects based on some parameter we pass from url, we got an error as below, here, UserInfo is our modal name from django, it can be any as per your code. Solution : Change the respective code from view.py change “get” … Read more

How to implement Pagination with Django & Django REST Framework

When you are working with lots of data like millions of object entries in the database, its just not possible to fetch complete JSON in one go which can content all the objects and parse to do any operations of the same. Hence to make the operations and user interface easier, Django provides pagination using … Read more