Django-rest-framework Questions
Ad
Axios GET request working on my local build but failing on Heroku - Uncaught (in promise) Error: Request failed with status code 500
I'm building an application using django/python backend and react/javascript frontend. the application is using axios to import data from another
How to render elements depends on select value in react
I'm newbie in react and i wanted to render different html elements depends on selected value and if its possible post datas in selected html to
How to update component on state change in redux
I am trying to update component on state change in redux. i have a list of images, when user deletes the image the component should update after
How to create custom login decorators in django
I am creating an app in django where all the authentication like login signup is done by using an exernal rest api so there is no database
DRF Serializer IntegerField Validation To Make Sure ForeignKey Does Exists
I've a modelserializer class which uses an integerfield as a replace for a foreingkey relation.
use of property decorator in Django to calculate Sum
I have two moldes in which one model consists of file field. i have to calculate total size of the files in the parent model within the property
Problem with filtering data via custom function in Python (Django)
I want to get 4 random objects from product i'm trying to filter it by check_existing_id function and
How can I fetch one column with conditons in Django
Id = models.autofield(primary_key=true) name = models.charfield(max_length=255) limit = models.positiveintegerfield(default='255') date =
How to list blog posts of a particular user in Django REST Api
How to list blog posts of a particular user. using listapiview, all blog posts are listed. how to list blog posts of a particular
Django Rest Framework - Automatically create new model B instance each and every time new model A instance is created
As said in the title. i want my django rest framework to create new model b object instance - with foreign key to model a , each and every time
Ad
ReactJS - How to log the specific field that is causing a 400 error code when submitting form
I am currently working on a web app that uses reactjs as the frontend, and drf as the backend, and i am working on the form validation right now.
Request body is not being passed from axios get call to Django Rest Framework
I have an issue while sending get request with a body in axios. it does not pass the body of the request to the backend. axios code looks
Why aws s3 bucket is showing invalid parameter type?
I am trying to upload image to s3 bucket but it showing me the following error. i am using react and drf. i am following
Checking properties of an object based on separete view (Django|Django-Rest-Framework)
I am using django-rest-framework and react.js. i need a seperate function in the backend to check if cartitem.amount is lower then
Image upload not working with DRF and React
I am trying to implement image upload functionality using react and drf. i believe it is not working properly. when i tried to upload image with
TinyMCE with React.js is displaying html tags in frontend
I am trying to implement tinymce with react.js along with drf in
How to show content to staff user only using React and DRF
I have a blog create view, where admin or staff user can only create blog, it is restricted from normal user and it is working fine.
How to submit post/put request to Django rest API via React front end?
I'm new to django, this is hopefully an easy question for the advanced users. i'm trying to submit a post/put request to a nested object in django
csrf and cors errors in localhost development of webpacked vuejs/reactjs/angularjs website with django backend
How can i run my vuejs application on localhost and have it send its api calls to my deployed django rest framework backend without getting cors
How to apply condition in boolean field in django rest framework?
I am working on a blog type website. where students will ask question and teacher will answer it. i put two user role teacher and
property method and other methods in django models
I have been using the property method every now and then and understand its uses. it basically acts the same as the field but without actually
Ad
Need to have url like /stories/<id>/episodes/1
When i create a new episode, id automatically increments. what i need? imagine, i have 10 episodes for a different stories, so if i create an
Trouble Installing React as an App within Django
I am using this tutorial to install react for the front with an api built in django.
Django response Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `<class 'NoneType'>`
My model has attributes fields as file and the person who uploaded it ,in my case i would want to show the error no file found on my website front
Best practices to build multi room (video and chat) with permissions in django and flutter
So past couple of days i have been looking into building multi room, where users are able to either chat, spectate or make a video calls dependent
Django Rest Framework: URL for associated elements
I have the following api endpoints already created and working fine: urls.py: router = defaultrouter()
How to use DRF Custom serializer field with DB model
I'm using relation database which is having binary field, so how can i use drf serializer to save the field value i have referred the
django-rest-framework: Why my API returns key instead value for my ENUMS?
I got stuck in my first api development. i hope someone can tell me what i do wrong. here is my models.py:
__init__() takes 1 positional argument but 2 were given django python
I'm trying to list user from api and also using jwt authentication but when i run localhost:8000/api/ get this error: _init__()
How to do PUT request without primary key?
I'm creating a like/dislike api for a blog using drf. i have like table which contains "post", "user" and "islike" fields. since django can't have
How to transfer a file to the converter function
I am looking for a way to transfer a file to a function that converts different formats to pdf. the transfer takes place at the moment of saving
How to call a function when the user POSTs an image in django rest api
I am making a face detection api that will take image as an input from a user. how can i call a function when the user creates a post request? i
Ad
AttributeError: 'Model' object has no attribute '....' Django Rest Framework
I have this model class entityphoto(models.model): user = models.foreignkey('users.customuser', on_delete=models.cascade,
How to test if an instance of a django model was created?
I am testing an api for a game and have some issues with a model. this is my model: models.py class
AttributeError: 'NoneType' object has no attribute 'build_absolute_uri' Django Rest Framework
I've got this serializer translating path to url, and it works on its own, but when i try to nest this serializer inside another serializer, i get
how can i get the username from API using flutter?
I want to get the username from rest api. i'm getting the id but not username. here's my serializer.py class
Uploading a CSV or Excel file along with json data through React html form to Django
I want to submit a form to upload either a csv file or an excel file, and provide additional information provided in the form, e.g. text.
How to connect Django Rest API to a html CSS JS frontend
I am new to programming and one thing i am very confused about, my boss has told me to create a rest api about an app which i have completed all
DRF is not updating the database
Here's the model: from django.db import models from datetime import datetime, timedelta # create your models here. def
does not contain a default export even after being correctly imported in React
I have this simple file which imports getaccestoken constant from another file. but i keep getting this error even when everything is defined
How to integrate getAccessToken with fetch function to load data from DRF backend to React Frontend?
React newbie here, but proficient in django.i have a simple fetch function which worked perfectly but then my project had no login authentication
React Django REST framework session is not persisting/working
I'm working on a project with django rest framework as back-end and react as front-end. when i set a session variable initially in some
How to change Representation of Many to Many related object in Django Rest Framework
I want the complete related model on get and use the id's on create, update and delete. i try to use to_representation. so i want to create an
Ad
Problem with saving multiple records in JSON file to MySQL using django-rest-framework
I'm newbie in django i'm trying to save json record using dango-rest-framework, here is my json file. { "result":{
Most Pythonic/Django way to dynamically load client libraries at runtime
I'm writing a django application in which we will have multiple client libraries that make calls to third party apis. we want to be able to
Overwriting nested serializer's create method throws TypeError: create() got multiple values for keyword argument
I want to send data to my api. my data structure is nested. so i am trying to overwrite the create method following the docs and so. when
DRF: Updating a model in another models serializer or view
So i have a user and schools model which are related as an owens(manytomany), student, and staff, if an owner registers and creates a school, i
How to make some fields optional in Django ORM
I've coded a function that signs up a user. in my sterilizer the name field is optional but whenever i try to create a user without giving a name,
dict object has no attribute
In frontend i use vue js , using axios i sent data to backend.but after clicking submit button i got this error: dict object has no attribute
django rest framework How to delete redundant queries?
I use django debug_toolbar to see sql query and i want to delete the second sql query. 1.(select ... from auth_user
How to overwrite get method in Django Rest Framework's API View
I am trying to build an api view that returns some data from my database depending on what i send as a request. i have a model
ValueError: Cannot assign "'Category'": "Course.category" must be a "Category" instance
I have a problem when i trying to run my unit tests. why does it give me that error message? code from tests.py: class
Is there any way to login to Django admin interface using username or email?
I want to implement a login system to login to django admin via email or username. does anyone know how to implement it. i use custom user model.
Django rest_framework_simplejwt token expiring too fast
With django i've set up authentication with jwt using the rest_framework_simplejwt app. i believe the default timeout for the access token
Ad
django rest framework serialize a dictionary without create a model
My data is like this, i want to serialize them without creating model for them. [ {'form': 1, 'count': 1}, {'form': 2,
Social login in flutter
I'm trying to implement social login in my application, the front-end is built with flutter and my backend with django and django rest
Is there a way to restrict access to DRF interface while still being able to access api-endpoints?
I'm creating a site that has django rest framework as its backend and reactjs as its frontend. i have multiple api-endpoints for various data,
Object permission function firing more than once
I'm using django rest framework. i want to give permission class to retrieveupdatedestroyapi view my permission class:
How to access auth_user_group table by ID
How can i directly specify the id column of auth_user_group table in queries/dml? i am referring to
How can I check if a boolean from a different model is true for a user of a team?
I have the following model i want to use to add rights to users that are part of a team: class rights(models.model): user =
solving error unauthorized /rest-auth/registration/ in django allauth
Hello guys i finally can ask for help since i believe my issue is holding me back for the third day now googling. am using react in the frontend
Use React fetch to call Dango REST getting a 403 response
I am hosting a react app (http://localhost:3000/) and want to authenticate a user
python social auth twitter 403 followed by 220
I am trying to authorize from android using python social, i am passing my token in format: "xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Django AttributeError object has no attribute 'upper'
I am implementing an api for an image labelling app. i have customised a create() method for tagging. a tagging contains a tag, which is an object
Unable to display API call result to WebPage
I have react app.js page from where i am calling django rest api and i am getting response as an array now this array i have nested components and
Ad
Django TypeError get() argument after ** must be a mapping, not list
I'm creating a serializer for a model with a manytomanyfield (tag_id) that refers to a tag table. serializers.py
Django rest api DRF - ViewSet hide a field from get but include for put
I have a field that i need to hide from a get put it needs to be there for a put in a viewset, how would i achieve this? my serialiser is
Can a Django project be hosted in Firebase? If yes, give me an idea
I know to host my django projects in pythonanywhere or something else. but, i need to know is that possible to host a django project in firebase
How to filter data in DRF from database by multiple keywords?
I'm a beginner and develop a little rest api project with django rest framework. there are a bunch of records in postgresql database with a text
custom field validation error does not show field name
I want to implement a change password endpoint, i have this view: def update(self, request): user_data = {} classname =
How do i setup routing for my API and my websocket
I'm making a django/react webapplication and would like to be able to use both a rest api and a websocket. to set the stage a bit: i have
Testing Django Models leads to TypeError: 'str' object is not callable
I am currently testing this model: models.py class tag(models.model): name =
Check if User sending request is in different model
I'm trying to create an api using the rest framework. i ran into a little problem. i want to be able to get a list of events for a specific user
How to access array of files in request with Django Rest Framework
I'm sending a request from a react frontend to python backend, in this request i'm sending a formdata() with an array of images, like this:
There is a bug that changes the size of the file transferred from axios to django
I am building a react frontend server and a django backend server. i transferred the image file from react fronted to django backend using
Serialize multiple InMemoryUploadedFile using ListField : Django REST Framework
How can i serialize multiple
Ad
Return URL in POST-method when working with base64ImageField and nested serializers
First of all, i'm pretty new to django and equally new to backend development so please go easy on me. i'm setting up a backend for a
I am getting TypeError:"int() argument must be a string, a bytes-like object or a number, not 'Question'"
I am getting error when i try to fetch question object from my choice object. the error is : int() argument must be a string, a bytes-like object
Do we have to host our Django site for our Flutter App backend?
Suppose i am creating a todo list app in flutter. i have used django to connect flutter's backend with the local host database. now my
Django Rest return 0 bytes zip file in response
I have simple method that return zip archive with .pdf file in it. here is part of code that generate zip archive and return it:
How to add points to an IntegerFiedl with serializer DRF
I've got serializer like this and each time i do put on that url, i want the number_of_points increase(+=1), but now when i do it, it stays the
How can I configure "HTTPS" schemes with the drf-yasg auto-generated swagger page?
I know in a traditional swagger yaml file, we can define the schemes with: schemes: - http - https //or schemes: [http,
Django overriding settings.py OBJECT in unittest not working
There is django app that uses django rest framework. the settings file contains an object with the settings:
DRF: how to validate arguments passed to serializer.save()?
How can i validate an additional arguments passed like this: class myviewset(multiserializerviewset): # some stuff def
"Expected a list of items but got type \"dict\"."
I am trying to build a api for updating first and last name for my user. i am getting the following error in http response {
Using lazy loading with DRF
I would like to make a simple lazy loading with django rest framework. i have a solid background with laravel where you
how to quick up the process of displaying images in React coming from backend (Django Rest)
I have an api in django and i am calling it from react front end, the thing is the api have to be called infinitely and in every request from
Ad
Django api backend filter table
The goal is to get the photos associated with a listing id. i have the bellow structure in django rest framework model.py
How to pass a query parameter to SerializerMethodField in django rest framework?
I want to filter out some instance based on the query parameter i get in the get call. class
'JobSerializer' object has no attribute 'email' what i am missing?
Serializers.py class jobserializer(serializers.modelserializer): # image = base64imagefield(max_length=none, #
Make related articles feature with python and django or react
I have a blog website backend is python + django + drf. on frontend i have react. at the article page i want to have "related articles"
How to encode utf8 code units to String and read back Flutter
My user input is a string, which also has emojis, so i have converted it to a list of utf8 code units. when i send this response to server, it
Forbidden (403) in a post request - djangorest-react
I have an endpoint for users registration. i use react for my front side of project. i send post request to the endpoint with json body to
Request.data or Request.query_params to access params in POST?
I'm building a simple api and i'm trying to test post request. post request should create a new record based on only one param: title. i'm
Djanog with React how to reset user password by sending user an email
I am using django with react, i am implementing a method to reset user password when users forget their password. my basic idea is to: 1)
django.db.utils.IntegrityError: NOT NULL constraint failed - drf_writable_nested
Created a simple app that allows me to create clients and then also add a features list as a field (which has multiple options).
add instances to a manytomany field in django rest framework
I have a very simple question and i'm surprised it hasn't been asked before on this website. i have the two following models: #
How to save a nested object in a post request correctly?
I am trying to work with a post request were i am first saving a tag object, which then becomes the tag field of a tagging object. however, no
Ad
password not encrypted during save update
I am trying to create a user using api. with my post/put request, my password is not saved in encrypted form.
Is it possible to add a calculated hyperlink in a django REST serializer?
I have this serializer that represents content abstract where i would like to add an hyperlink field that is not in the model, but calculated by
Ad
Blog Categories
Ad