Category "django-rest-framework"

Multiple Token Authentication in Django Rest Framework

How can a user login in multiple devices because what we have is just a single Token Authentication on our django app. As an authenticated user when I login on

Django custom model Interger extrafield not saving in the database return None instead

my models class UserManager(BaseUserManager): def create_user(self, email, password=None, **extra_fields): print(phone_number, 'phone_number')

How to manually customize parameters of DRF views using drf-yasg Swagger?

I am using drf-yasg package to integrate Swagger with DRF. As documentation said I used @swagger_auto_schema decorator to manually customize auto-generated endp

How to POST multiple objects in one JSON request?

I am using django-rest-framework and recently I encountered a problem. I need to post such request and get 2 objects created: { "lease": 28, "date": [

How can I use a third-party API which has basic authentication (username, password) in Django?

I have one third-party API (a URL). To access that URL I have to give basic authentication which is username and password. How can I get data from that API usin

Django testing rest-framework: APIRequestFactory vs APIClient

Being new to testing i'm looking to test my API in Django (Django-rest-framework). I'm setting up tests for my views, that is my API endpoints. Now looking ov

vuejs 401 unauthorized with axios from django backend with token

im trying to fetch data from django rest backend with axios in vuejs frontend but each time i get this error. the tokens match but it is still not authorizing.

Error message "`coreapi` must be installed for schema support"

I am trying to generate Swagger documentation using drf_yasg and it was working fine, but now it’s not. It’s giving me an error and I can not find a

'CityListViewSet' should either include a `serializer_class` attribute, or override the `get_serializer_class()` method

I am assuming by the error in the title, once more here for clarity 'CityListViewSet' should either include a `serializer_class` attribute, or override the `g

How to add data to ManyToMany field using Django Rest Framework?

I'm relatively new to DJango and I am looking to add data to a many-to-many field using serializers from rest framework. My Model: class IngFamily(models.Mode

How do I use django rest framework to send a file in response?

I need to send a pdf file and some other parameters in response to a get API call using django rest framework. How can I do it? I tried this but it gives an er

How can I make a Django REST framework /me/ call?

Suppose I have a ViewSet: class ProfileViewSet(viewsets.ModelViewSet): """ API endpoint that allows a user's profile to be viewed or edited. """

This QueryDict instance is immutable

I have a Branch model with a foreign key to account (the owner of the branch): class Branch(SafeDeleteModel): _safedelete_policy = SOFT_DELETE_CASCADE

Can't import rest_framework in Django

I'm trying to stand up a Django site and I am attempting to setup Report_builder with that. I just got the front end of report builder to work but it is not ret

I can't distinguish roles with my implementation in DRF+Angular

I've made an implementation of a login system using django as backend and angular as frontend. In the backend the authentication is implemented via the view ass

How to deal with model changes in Django Rest Framework?

This is not a question for a particular use case, but for something I noticed in my experience doing APIs, specifically with using Django and Django Rest Framew

last_login field is not updated when authenticating using Tokenauthentication in Django Rest Framework

I'm working in a project which relies in a Django User model and TokenAuthentication under DjangoRestFramework I was requested to get last login datetime for e

How to return an rest_framework.response object from a django custom middleware class?

I am trying to write a middleware class that ensures that the user is logged in. But the problem is this middleware class will only be applicable to a small set

Django Rest Framework Postman Token Authentication

I am using Django Rest Framework Token authentication and if i do curl http://localhost:8000/api/v1/users/?format=json -H 'Authorization: Token 0a813fdcd3f8846d

how to pass post parameter in Django rest swagger?

I have integrated swagger with django rest framework, but the swagger docs does not create a input box to post data for post request. I am using Function based