django-rest-framework Questions

3

In the Django Rest Framework I would like to post a file, received as an InMemoryUploadedFile, to a different server as soon as it is received. It sounds simple, but the request.post() function do...
Lymanlymann asked 5/7, 2018 at 10:52

5

Solved

I've a periodic celery task which needs to store representation of a object in a specific json field. Here is the simplified model structure. Parent <-- ChildWrapper <-- Child Image So basica...
Seraglio asked 19/8, 2019 at 9:50

2

I am using django-rest-framework-mongoengine for a personal project. I want to be able to send extra data in list requests. I have written 2 mixins for that purpose: UserSearializerContextMixin: C...
Bonefish asked 25/11, 2015 at 7:33

2

I'm trying to achive that such endpoint /api/messages/<str:email>/ will return a list of messages for given email. So in my ViewSet I've created a function with @action decorator @action( de...
Acetylene asked 25/7, 2020 at 15:5

2

Solved

I'm trying to return UserSerializer after successful login through dj-rest-auth. I followed the steps that were told in After login the `rest-auth`, how to return more information? which has a simi...

7

Solved

I have a model in my API that has a foreign key to a table with tens of thousands of records. When I browse to that model's detail page in the browsable UI, the page load takes forever because it i...
Ermine asked 3/9, 2013 at 8:42

4

I have tried to add authentication to my Rest API using OAuth Toolkit. I get to the login page and enter in my username and password then redirect to my api. I then get a message {"detail":"Authent...
Palmy asked 7/12, 2014 at 14:11

1

Currently I have a project using django and rest_framework to get some basic APIs on the run. The problem is, when i make a view using the generic lib on rest_framework and DjangoModelPermissions, ...

2

When a request is made to my ListAPIView , the get_queryset() method is being called multiple times. It was being called 4 times until I removed the default django model permissions, but now it is ...
Fenn asked 20/8, 2016 at 22:17

2

Solved

I want to optimize the django app and for this I would like to know How can I check if my query is hitting database or I am getting result/return value from cached version? For example: products = ...

4

Solved

I were following the book Django for APIs by William.S.Vincent. In Chapter 8: User Authentication, I make Implementing token authentication and use dj-rest-auth and django-allauth to make registrat...
Horsefaced asked 24/4, 2023 at 16:3

2

My application was running fine till few days back, but now all of a sudden i'm seeing this error and not sure what it means, please help. Error: File "/myproj/myapp/urls.py", line 8, in ...
Reconstructionist asked 17/4, 2023 at 12:23

6

I am using Django REST framework for API and Angular SPA with Restangular to communicate with the API. Sometimes, I have to add more than one object using the API and I think I can send them togeth...
Flue asked 5/4, 2014 at 12:45

4

Solved

I am able to upload a single image with the following code. If I select multiple images then only the last image among the selected image is getting uploaded. models.py class Image(models.Model):...
Lamblike asked 20/10, 2018 at 6:59

4

Solved

I am new to Django Rest Framework. Using serializer and views a simple CRUD is easy. When the logics increase, it is quite confusing where to write logics in serializer or views. Some developers do...

6

Solved

I am using Django REST Framework and i am using filters to filter the query set. http://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters like this http://exa...
Scotfree asked 28/11, 2014 at 5:36

9

Solved

I'm using postman to check json response from my django-rest-framework. When my first try to post id, email, password through POST method to my django on AWS(amazon web services), it works well. I...
Gilley asked 4/9, 2016 at 9:24

8

I have some model with a timestamp field: models.py class Event(models.Model): event_type = models.CharField( max_length=100, choices=EVENT_TYPE_CHOICES, verbose_name=_("Event Type") ) even...
Photosphere asked 12/5, 2016 at 10:17

6

How do I write unit tests for those endpoints of my API that require oAuth authentication? Simply adding oAuth tokens to the request headers doesn't work (perhaps because the test database is not...
Caliginous asked 13/5, 2015 at 7:11

12

Solved

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 tokens to authenticate a user, but the ...
Tracietracing asked 13/4, 2017 at 12:52

14

Solved

Here's my settings.py: INSTALLED_APPS = [ 'rest_framework', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages',...
Kristoferkristoffer asked 19/12, 2020 at 11:57

3

Solved

I have the following view in my views.py - class FilterView(generics.ListAPIView): model = cdx_composites_csv def get(self, request, format=None): vendor = self.request.GET.get('vendor') fil...
Leopoldine asked 22/8, 2014 at 14:54

5

Solved

I am developing the rest apis for an android app using Djnago Rest Framework. The android guys told me that it would be nice if I could provide the responses in a common format, like { “Status”:”...
Rozalin asked 23/2, 2018 at 4:46

8

Solved

If I have a view like: class MyAPIView(APIView): def get(self, request, name=None): return {"hello": name or "world"} How can I get that included in the generated documentation? Specifically, ...
Atalee asked 15/9, 2013 at 22:9

3

Solved

I know this topic has been widely discussed, but most of the examples are about two factor authentication in standard Django templates, while in my case i want to add two factor authentication to a...
Underpinning asked 30/3, 2021 at 22:29

© 2022 - 2024 — McMap. All rights reserved.