Category "django-rest-framework"

Django Rest Framework gives 302 in Unit tests when force_login() on detail view?

I'm using Django Rest Framework to serve an API. I've got a couple tests which work great. To do a post the user needs to be logged in and I also do some checks

How can to get data from related model in Django Rest Framework?

I have next models class User(AbstractUser): ip_address = models.CharField(max_length=15) class Statistic(models.Model): user = models.ForeignKey(User

i want connect my sp-api amazon seller and django

hey i try to fix this code for amazon seller sp-api and it's not work at all cannot connect def amazon_list(request): #api_request = requests.get('https://j

Change renderer class inside custom pagination in django rest framework

I am using custom renderer class by default in settings.py. For api I check query parameter "page", if it exist then I paginate result else return normal respon

Django - export excel make it faster with openpyxl

I am using Django restframework and I am trying to export excel. My issue is the process is take a lot of time till it generates the excel file. The final file

Getting error while partial update data in drf

Hi Everyone i am creating api for partially update record, but getting error [patch() missing 1 required positional argument: 'id'], please help me out views.py

DRF/Multi-tenant - How to specify tenant host (domain) in unit tests?

Environment - Django, Rest Framework, Multi-tenant. In my unit tests, I'm trying to hit an endpoint in a tenant schema (not in Public). It is failing because

Django PageNumberPagination customize error if page number out of range

I'm currently trying to create an API that return list of objects with page and limit per page input from url parameter using django-rest-framework which i alre

Django override the error message that Django shows for UniqueConstraint error?

I want to customize Meta class constraints default message. Here is my model that I have been working out. class BusRoute(BaseModel): route = models.Foreign

django filter for NOT IN as lookup_expr

We can make the django filter with "in" expression sending comma separated string. Such as import django_filters class NumberInFilter(django_filters.BaseInFilt

Django. ''The `actions` argument must be provided when calling `.as_view()` '' when I try to allow DELETE, PUT, ETC

I have to allow delete and update requests from front for my objects of some model. I wish to delete instance and appropriate row in DB. I tryed to use info fr

Need to do POST method for the Nested serializers using django

models.py class Organisation(models.Model): """ Organisation model """ org_id = models.AutoField(unique=True, primary_key=True) org_name = m

Django channels rest framework don't return data of subscription in production environment (gunicorn/daphne/nginx)

Hi everyone I deployed django with channels via daphne for websocket and gunicorn for normal request http with reverse proxy nginx, I have a problem that has no

How render django-table when click on TamplateColumn delete button?

I try build user table with delete option I use django table2 to view the list and when I click on delete button and delete user I want to render only the tab

How to disable "django login" hyperlink while accessing swagger ui in drf-yasg?

I'm using drf-yasg to add swagger auto schema to my endpoints. The swagger-ui is being visible at /api/v1/swagger/ At my local setup this link is working fine a

TypeError: 'BasePermissionMetaclass' object is not iterable in django rest framework

i looked at other questions regarding this issue and their problems were in the REST_FRAMEWORK = ... values in settings.py file . is there any error in mine ? I

How can I use Validator in perform_create to limit image upload size for Django Rest Framework?

In my view, I'm able to restrict an image's resolution to a specific range of width and height, but I don't know how to use this very method to also restrict an

DRF Error: Cannot assign must be a instance

I'm working on an app that lets you track your expenses and I'm trying to create an 'balnace' object when the user registers, but when I try so I get an Error:

User account delete in django's rest

I want create view which can deactivation user's account. when i create view and send delete request i have error - > "detail": "You do not have permission t

Save multiple objects serializers only if both of them are valid

I have multiple serializers objects that comes from the request as json file. I want to store them inside databases only if they are Valid (all of them must be