Category "django-rest-framework"

How do you authenticate a websocket with token authentication on django channels?

We want to use django-channels for our websockets but we need to authenticate as well. We have a rest api running with django-rest-framework and there we use to

Django OAuth Toolkit and POSTMAN

I made a django OAuth server using Django OAuth Toolkit. I've setup the code right and when I use CURL in the following way: curl -X POST -d "grant_type=passw

Why can't I add a ManyToMany relation to an object in Django?

I've got an api made in Django which has two models linked by a ManyToMany relation. class Type(models.Model): name = models.CharField(max_length=64) ap

Django Rest framework, how to include '__all__' fields and a related field in ModelSerializer ?

I have two models, one with M2M relation and a related name. I want to include all fields in the serializer and the related field. models.py: class Pizza(mode

ImportError: Could not import 'rest_framework_simplejwt.authentication.JWTAuthentication'

I am trying to deploy a django app on GCP but when i try to make migrations it gives me this error: ImportError: Could not import 'rest_framework_simplejw

How to dynamically remove fields from serializer output

I'm developing an API with Django Rest framework, and I would like to dynamically remove the fields from a serializer. The problem is that I need to remove them

How to test authenticated POST request with Pytest in Django

I want to test an authenticated post request on an API using Pytest. This is what I am doing so far: def test_auth_user_can_create(self, client):