django-rest-viewsets Questions
4
Solved
Please help me solve the problem.
I was building an app consisting of Django Rest Framework and ReactJS. I used ViewSets.
my error:
response data:
{"detail":"CSRF Failed: Origin ch...
Preferable asked 6/1, 2022 at 19:14
8
Solved
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 `get_serializer_class()` method.
that...
Kendry asked 18/7, 2017 at 3:44
4
I have a Django rest framework GenericViewset for which I am trying to set up pagination as follows:
#settings.py
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS':
'rest_framework.pagination.PageN...
Dynamometer asked 15/2, 2019 at 4:47
1
@action(detail=True, methods=['get'], url_path='password-reset/<uid64>/<token>', url_name='password-reset-confirm')
def password_reset(self, request, uid64, token):
pass
this is the ...
Margheritamargi asked 11/1, 2022 at 22:40
2
Solved
I am trying to consume data from a callback API that sends the POST request in this format:
[
{
"key1": "asd",
"key2": "123"
}
]
However my API currentl...
Aristotle asked 29/10, 2021 at 3:0
7
Solved
PUT and PATCH are both part of the same mixin (The UpdateModelMixin).
So if I extend it like so:
class UserViewSet(mixins.UpdateModelMixin, GenericViewSet):
queryset = User.objects.all()
seria...
Prognostic asked 20/4, 2017 at 20:43
1
So I am trying to upload file AND Post JSON data to my API following this solution. I have created the Parser, placed it in my viewset. I even receive the image and the JSON data in the to_internal...
Steamship asked 28/7, 2021 at 6:40
2
Solved
I have a model that I want to filter on multiple values.
my model:
class Product(models.Model):
ean = models.CharField(max_length=13, unique=True)
product_id = models.CharField(max_length=20, nul...
Paleo asked 26/11, 2020 at 10:23
3
Solved
I am using django rest framework, and I have an object being created via a modelviewset, and a modelserializer. This view is only accessible by authenticated users, and the object should set its 'u...
Kitty asked 6/4, 2019 at 14:10
1
Solved
I have a frustrating problem with POST requests on a DRF serializer - DRF is, for some reason, going to an incorrect view name, and view_name is not a settable property on PrimaryKeyRelated Field.
...
Madrigal asked 24/12, 2020 at 16:2
2
Solved
Im learning Django REST Framework and Im trying to get to work a simple ViewSet but I keep getting this error on the console when trying to run the server
File "C:\Users\anahu\Projects\guatudu-ap...
Genuine asked 20/1, 2020 at 4:0
2
Is there a way to handle all the exceptions globally without using try-except block in django rest framework.
I want to convert html error page that django is throwing to a customised json object r...
Wasteland asked 27/2, 2020 at 4:54
3
Solved
I have a problem with parsing request.data in viewset. I have a model that can add multiple images depending on a product.
I want to split the image from the incoming data, send product data to P...
Klusek asked 11/4, 2020 at 17:49
3
Solved
im trying to filter search a rest api page and want to use a method field as one of the search fields, however when I do this I get an error stating the field is not valid and it then lists the fie...
Stickney asked 30/8, 2019 at 11:11
2
Solved
I read on DRF doc that you can filter againt query parameters by overriding .get_queryset(). I am looking for the best practice, on what to return, in case the filters are incorrect and where to re...
Wrongful asked 13/2, 2019 at 9:52
2
Solved
I have been trying to use django-filters but the objects are not getting filtered. Also, the permission is not working for the partial_update views
I have a Viewset which has the basic actions lik...
Ant asked 17/9, 2018 at 11:3
1
Solved
I created API Views using django rest framework, I have a model which icsconsist of list of states in it and it associates with another model called country by the help of country(which consist of ...
Yongyoni asked 13/7, 2018 at 11:18
1
Solved
I am using Django Rest Framework, currently to pull some data from the backend we are using Get request, but due to URL limit going high we are planning to implement a Post request. To do this firs...
Synopsis asked 21/2, 2018 at 9:4
1
Solved
I have viewset like below :
from rest_framework import viewsets
from paas.serializers import UserSerializer
import logging
logger= logging.getLogger(__name__)
class UserViewSet(viewsets.ViewSe...
Gelignite asked 5/11, 2017 at 14:6
1
Solved
I have seen viewsets implemented like this:
can we expand on this line of code in the django rest frameworks docs:
"If we need to, we can bind this viewset into two separate views, like so:"
use...
Wheezy asked 20/7, 2017 at 4:52
3
Hi I have a model like:
class Appointment(models.Model):
hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE)
patient = models.ForeignKey(Patient, on_delete=models.CASCADE)
My Vie...
Montemontefiascone asked 14/6, 2017 at 4:31
1
Solved
I have defined a Model like this:
class Doctor(models.Model):
name = models.CharField(max_length=100)
is_active = models.BooleanField(default=True)
My Serializer:
class DoctorSerializer(ser...
Schaffhausen asked 1/6, 2017 at 22:15
2
Solved
Over here: http://www.django-rest-framework.org/api-guide/viewsets/#modelviewset it says "The actions provided by the ModelViewSet class are .list(), .retrieve(), .create(), .update(), .partial_upd...
Dialect asked 6/3, 2017 at 0:59
1
© 2022 - 2024 — McMap. All rights reserved.