How to get the body from the POST request correctly in the Django Rest Framework
All I want is to get the body from my request, but I don’t understand how to do it, I tried request.data but it returns a string, after I tried using json.loads(request.data), but it just refused to work. I just want to parse the nested json, why is it so difficult in Django.
Creating foreign fields in Django right after the object creation
I am getting a JSON input with the fields description
and choices
for a Question
model. The Choice
model also has a foreign key field pointing to Question
with a related name of choices
. However, in the JSON, the Choice
will come without the question_id
field, in order to be assigned after the creation of the Question
Is it possible customize drf api root and grappeli in a Django Project?
I am using Django Rest Framework and Grappelli in my Django project.
How to access fields of a table that is a foreign key to another in django rest api
I am writing dhango rest api.
ProgrammingError: relation “users_customuser” does not exist
I have created a custom user as follows:
Django REST Framework 401 error with valid credentials
I’m having an issue where I send a POST request to an api endpoint restaurant/api-token-auth
and I get a 401 error with the json response:
UnicodeEncodeError at api
enter image description here
Django REST API Form Showing “Content” Only
In my REST API screen I’m seeing this view:
Reverse lookup for fields with choices in django models
I have following model :
Calling the create method of a ModelViewSet from another ModelViewSet
I need to create objects of model B from the views.py file of A. I was able to do it using the serialiser of B (see # OLD METHOD using serializer) but I would like to know how to use the create method of viewset B from viewset A