How to cache individual Django REST API POSTs for bulk_create?

I have a Django REST API endpoint. It receives a JSON payload eg. { “data” : [0,1,2,3] } This is decoded in a views.py function and generates a new database object like so (pseudo code): …

Django: How to use data from a function as a field in Meta class

I’ve created a function in my serializers.py that call an external API and give me a dict back. How can I use the output from return downloads in the get_all_files as a field in class Meta? After the …

Creating django api view that returns filtered objects

Problem Description I’m new to django-rest-framework and got a problem in my view. I have three models namely #User, #Profession and #StudentProfessions. I need to create an api-view that takes …

How to return empty queryset from serializer.data Django Rest Framework

view.py class User_ListView(APIView): permission_classes = [DjangoCustomModelPermissions] queryset = User.objects.none() def get(self, request): param1 = request.query_params.get(‘…

How to get the most liked users in django rest-api

So I have a social media app, where users can like the posts of other users. Now I want to fetch the top 20 users who have received the most number of likes. I am pretty much confused how to query my …

Best practise for creating database objects from .csv file

My situation is: having .csv file with some columns e.g. name, surname, age, activity, and others I want to create objects in my relational database with row from this file being single object. Column …

dj-rest-auth limit social sign up to a specific email address domain

I’m getting started with dj-rest-auth and I have an app which allows user to only sign in via google. However, I want users to only be able to access my service with a specific google apps email …

Can’t add a field to serializer.data django rest

I have a view that displays the project by ID. I want to add one more value into response, but for some reason it is not added. class ProjectApiView(APIView): def get(self, request, project_id=…

how to perform post request on nested serailizers in django rest framework

Hii I am new to django rest framework i am able to perform put delete and get operations but unable to perform post operations models.py class User(auth.models.User, auth.models.PermissionsMixin): def …

How can I fix my REST view to PATCH and serialize updates to an ArrayField() in my model?

I have a view that is used to update a field in my model. It’s represented as follows: stock_list = ArrayField(models.CharField()) Each value in the ArrayField is separated by commas. I used a custom …