Category "django-rest-framework"

How to render a new user registration form from a model ViewSet in Django Rest frame work

class RegisterViewSet(viewsets.ModelViewSet): http_method_names = ["post"] permission_classes = (AllowAny,) serializer_class = RegisterSerializer

Django dumpdata serializing an int as string

I've been trying to make a custom class/type, defined in a separate db.py file, to be properly serialized as an int when doing a manage.py dumpdata command, but

The response content must be rendered before it can be iterated over. Django Rest Framework

I have a Cart model and Cartserializers. I am trying to do that is if cart defects exist in the cart and then update the cart by increasing the quantity of cart

DRF ModelSerializer meta extra_kwargs not working for related fields

I am developing an API in DRF and have stumbled upon one issue that hopefully you can help me to solve. Let's assume I have the following model and a serializer

GIS - Can i have multple geo_fields (point, polygon, line) in 1 model and then serialize with DRF?

If I have 1 model with 3 different geo_fields in (point, poly and line), can I serialize all of these with django-rest-framework-gis? My model: class Job(BaseMo

Clean request.data in django rest

Quick question: I know that Django has some baked-in security at different system levels, but I'm not sure if accessing the the request.data property directly s

I want to assign value of logged in user's user_company to the user_company field of the newly created user

When a user creates a user record for a client, the new client should should have the current logged in user's User.user_company value. In the problem here, I w

React app won't connect to django-rest database

I'm to update the frontend of this site https://github.com/ildebr/store-repository it has a react frontend and a Django backend, auth is made with Django-rest-f

How to Access Settings file from .py file - DRF

This is my project structure. I am trying to access settings.py file from lookups.py I am importing using following code, import os import sys import django sy

Django model default value in response

I want to have a default value in my django model response value Sample model query myModel.objects.filter().values("username", "user_gender") I want to have a

How to disable "HTML" tab in DRF Browsable API but keep "Raw" tab available

When using more complicated representation schemas (e.g. nested objects and lists), the "HTML" form part of the Browsable API in Django REST Framework becomes m

How to set max length on integerfield Django Rest

Okay so I need to have my field have a maximum of 10 integers allowed to be entered. I tried MaxValueValidator but I figured out that this just needs a value th

CSRF cookies not set - React, JWT, Django

I'm rather confused regarding the following error: "Forbidden (CSRF cookie not set.)". This error is received during attempting to logout, login, signup. The pr

How to create a persigned url for a private s3 bucket using django rest framework

models.py def upload_org_logo(instance, filename): ts = calendar.timegm(time.gmtime()) filepath = f"Timesheet/org_logo/{ts}" if instance: b

how can i filter data between two time i am using date time field for it in django rest framework

I am trying to filter my data with a date-time field, but in my case its not working. So please someone suggest to me how can I filter my date with time start_t

Django filtering on a queryset not working

I am trying to add a filter on an existing queryset based on a condition but it doesn't work. This works queryset = None if self.is_instructor =

Django: how to count posts related to a category in django?

i have a model class Category and also a model class Course. i want to count all the courses that are related to a model e.g: Web Devlopment - 26 Courses i dont

Django WebSocket DISCONNECT /ws/chat/lobby/ [127.0.0.1:3022]

i want to create chat app, i follow the https://channels.readthedocs.io/en/latest/tutorial/part_2.html here, chat/ __init__.py routing.py urls.py

Protected Route by checking JWT saved in user's cookie

I just finished implementing Google social authentication in my NextJS + DjangoRest project following this blog post. I am trying to figure out how to make prot

How to get data that belongs to specific user in Django Rest Framework?

I haved Format_List model with relation with Django user and now I want to get the data belongs to specific user by giving user id or after user login. models.p