Most voted "django-rest-framework" questions
57 questions
Sort by count of
-
3
votes0
answers70
viewsWhich python web service to use in an application using knockoutjs?
I need to create a python web service for my Django application. My application was built using Django and knockoutjs, but I don’t use models or Forms, knockout ko.observable. I thought about using…
-
2
votes1
answer598
viewsDjango request.GET
Is there any simpler way to do that? if "id_parada" in request.GET: id_parada = request.GET["id_parada"] else: id_parada = ''
-
2
votes0
answers238
viewsDjango-Rest-framework update user from another user
I need to change users from another user. But when I call serializer.save() it is not saved in the database and does not present error. My user model: class User(AbstractBaseUser, PermissionsMixin):…
-
2
votes2
answers74
viewsProblem when displaying routes in Root Api
I have a file urls.py in the project with my API routes, I am importing the routes and concatenating into a variable called api_urls, to then include the variable with the routes, but when doing…
-
2
votes1
answer98
viewsTO BE executed asynchronously
Is there any way to execute a FOR asynchronously? What happens is this, my program recovers a large number of data from the database, processes it and returns the result to the user. I’m doing it…
-
1
votes2
answers148
viewsConsultation that feeds grid and subgrid?
How, for example, to generate: Autor 1 +-- Livro 1 +-- Livro 2 Autor 2 +-- Livro 3 +-- Livro 4 using Django-Rest-framework? This in a single query? I searched found with consultation and details.…
django-rest-frameworkasked 10 years, 11 months ago McQuade 403 -
1
votes1
answer467
viewsHow to submit a post using Django Rest Framework and Angular.js
How do I submit a post on Angular? I ran a test here and requires you to report to PK: index.controller('EditController', function($scope, $http) { $scope.save = function() { var in_data = { name:…
-
1
votes1
answer263
viewsDjango-Rest password validations in two fields
How to recover values from html elements in a custom validation with Django-Rest ? How would Django-Rest the similarity with the code below ? def clean(self): password1 =…
django-rest-frameworkasked 8 years, 10 months ago Welington Carlos 81 -
1
votes0
answers98
viewsHow to get nested Rest?
I happen to have the classes Pessoas, Profissoes, ProfissoesPessoa and QualificacoesProfissoesPesssoa In thesis my Models is so below: # -*- coding: utf-8 -*- from django.db import models from…
-
1
votes2
answers368
viewsDjango Rest compare user 'sector' id with publication 'sector' id
Well, I’m messing with an API and I want it to return content only when the user sector is equal to the publishing sector API for publications: The user has a sector field also equal to this, and…
-
1
votes0
answers54
viewsProblem when making a GET on my site when it is entered via www (React + Django)
I have a Jango application that uses React on one of your pages (not two separate Servers). On my React pages, I make HTTP requests to Django for the api using Django Rest Framework. This…
django react http-request https django-rest-frameworkasked 6 years, 1 month ago Gabriel Cavalcanti 47 -
1
votes1
answer48
viewsSaving relationships using the Django Rest Framework
When I try to save a new student informs the error NOT NULL Constraint failed: student_student.teacher_id Can someone help me? class Teacher(models.Model): name = models.CharField(max_length=128)…
-
1
votes1
answer806
viewsError including app urls in project.py urls
I’m at the beginning of a project with Django 2.2.1, creating the first apps and making the links between the pages. In the project’s urls.py, including the Accounts urls worked (with the…
-
1
votes1
answer355
viewsgenerate a pdf only with arguments passed by a Django form
Hello, I’m having a problem generating a pdf, I need to create filters for a more detailed report, my code consists of a simple view of Template where I set up the form with the "GET" method, and a…
-
1
votes0
answers205
viewsDirect assignment to the forward side of a Many-to-Many set is prohibited. Use morador.set() Instead
I’m building an API for a condo system, and when I try to select the residents, I get the following exception: TypeError at /apartamento/ Direct assignment to the forward side of a many-to-many set…
-
1
votes2
answers230
viewsWorking with querysets and Celery
Following what I had asked here, I keep trying to run my code asynchronously. I’m trying to use Celery to perform this procedure, but I’m having some problems. I had the following: def get(self,…
-
1
votes1
answer57
viewsNested Relationships
Guys, I have a question regarding the nested relationship. When my code gets that way: class CategoryListSerializer(ModelSerializer): class Meta: model = Category fields = ['id', 'name',…
-
1
votes0
answers75
viewsPostgresql connection to Django
Good afternoon, I’m having a problem connecting Django with Postgresql I installed psycopg2 on Jango, changed the connection in Settings.py to connect with postgre and when I give the runserver it…
-
1
votes0
answers226
viewsHandle POST elements in Django Rest Framework
Good night, I own a model with: camid = models.AutoField(primary_key=True) A serializer: class CameraSerializer(serializers.ModelSerializer): class Meta: model = Camera fields = ["camid", "nome",…
-
1
votes1
answer161
viewsHow to use a Python function in Django
I’m currently having a problem where I haven’t found any solution that I’ve been able to understand and execute. I will be summarizing here the scope of what I need, otherwise it would be very…
python-3.x django django-templates django-rest-framework django-querysetasked 4 years, 2 months ago Bruno Marques 21 -
1
votes1
answer27
viewsHow to update "deleting" objects from a nested object?
I have these two models to follow: class Questionario(models.Model): numero = models.IntegerField() nome = models.CharField(max_length=300) class Meta: db_table = 'questionario' verbose_name =…
-
0
votes1
answer228
viewsError in API Rest POST - Windows Forms
I’m trying to register (POST) this endpoint https://geradornf-prod.herokuapp.com/ (is a Simple API I made with Django Rest) I’m using Windows Forms C# Follow the call: using (var client = new…
-
0
votes1
answer816
viewsSecurity Authentication Token Django Rest Framework
Good guys I’m using DRF(I’m novice rs), to mount a small API. The problem comes in authentication... thinking about expanding my API to use in a mobile app in the future, I’ve been wanting to use…
-
0
votes0
answers20
viewsDjango Rest Framework retrieves Empty values Instead of null when using Oracle DB
I’m using Django Rest Framework, so when i Insert a field with null value [POST Model], it retrieves it with an Empty value [Get Object Detail]. Why does it happen?
-
0
votes1
answer227
viewsWhat are Django’s view, serializer and model settings?
I’m studying the 'Django' and would like to understand the definitions view, serialize and model and which route between them. Thank you
-
0
votes1
answer57
viewsDjango application (NGINX and WSGI) consuming only one core, reaching 100% and locking
I have a problem that I have deployed with NGINX and UWSGI on a debian 9 with 24 cores, the application is simply running correctly, but when I upload an excel file the application is using only one…
-
0
votes1
answer87
viewsPython rest_framework how to change URL?
How can I change the urls in rest_framework on Django? The router defaults to using the creature ID in the URL ex. /api/Creatures/1/ I want instead of appearing the ID, appear the name of the…
-
0
votes1
answer39
viewsHow to calculate the frequency the data appears on Django?
Hi, I’m making a search bar with filters, in it the user can choose whether to sort by frequency or sort by another field (which is ordering everything right), what gives problem is when searching…
-
0
votes1
answer94
viewsDjandorestframework standardize endpoints for methods with different permissions
I am using Django 1.10 with DRF lib. I created an Endpoint /api/contact/ and in this endpoint I apply 2 methods (GET and POST), and GET can only be viewed with permission, and POST can be requested…
-
0
votes1
answer123
viewsUnidentified session in some logins on Django
I am doing a maintenance on a Django app version 1.5 with DRF 2.3. This app features off-the-shelf user authentication that works well. See a summary below: Accounts/views.py class…
python django python-2.7 django-admin django-rest-frameworkasked 7 years, 2 months ago Kaio Cesar 305 -
0
votes1
answer1564
viewsHow to use token to validate a Django Rest Framework user login
Hello, I’m a little lost when authenticating a user by Django-Rest-framework, I was following the tutorial of the channel Codingentrepreneurs in the video 32 of the Blog API…
-
0
votes0
answers19
views[@action Django restframework ]: execute commands when a new client is registered
good night. I am developing a customer registration API, and I would like it that every time a new client is registered, runs something, and I tested a code and it didn’t work. someone can help me?…
-
0
votes0
answers436
viewsConvert HTML to PDF and insert Image with Django
The image does not appear in PDF, I use xhtml2pdf. reports/sol_access.html <img src="{% static 'img/small_logo.png' %}" alt="Blue Tech" style="max-width:200px; margin-top:10px"> view py. ` def…
-
0
votes1
answer196
viewsHow to filter an Apiview to show messages related to a user?
I want to create a view using Apiview, which shows all messages sent by a user specified in the url. py.models: class Message(models.Model): body = models.CharField(max_length=500) normaluser =…
-
0
votes1
answer309
viewsHow to view my index.html template in the Django restframework?
I have a problem with a test I have to deliver for a selection process I’m conducting. I’ve tried every possible and imaginable way to solve it, but I couldn’t. When trying to call an index.html…
-
0
votes1
answer147
viewsDjango Rest Framework with Images
Well I’m still studying this framework, I researched a little tried some ways but did not work. Error: 'Unboundlocalerror at /api/servicos/1/ local variable 'Service' referenced before assignment'…
-
0
votes0
answers41
viewsNested components and error rotation
Guys are developing a system in React that will consume a Rest api in Django. For development I am using the React, React-router-dom, mdbreact. I was making a form to create user account and when I…
-
0
votes0
answers347
viewsHow to create a function to pass a JSON in the Django Rest framework?
I am studying drf and would like to create a function that would receive a list in JSON format and do an update by serializer. To illustrate better follows as I am thinking. example_serializer.py…
-
0
votes1
answer509
viewsHow to Serialize more data from more than one table in Django Rest-framework
Speak People! I am the following problem: I have a buy-and-sell schedule: class SalesOrBuy(models.Model): client = models.ForeignKey(Client, null=True, on_delete=models.CASCADE) mode =…
-
0
votes1
answer486
viewsProblems with Urls in Django
Expensive, I’m with the following mistake my project: django.core.exceptions.ImproperlyConfigured: The included URLconf 'api.urls' does not appear to have any patterns in it. If you see valid…
-
0
votes1
answer160
viewsBring back multiple filtered Django Rest data
Good morning, How do I bring multiple data from Django Rest, for example : instead of appearing the id of the students I want to bring the names... I don’t know if it’s possible but I hope it is...…
-
0
votes1
answer148
viewsError while trying to create new field in a model in Django
When trying to create a new field in a model while creating an api, I get the following error when running the command runserver: That would be the class: class Person(models.Model): teste =…
-
0
votes1
answer101
viewsUpdate all Fields of a model, except the key Primary
I am starting the studies in DRF and during a test I came across the following situation: it would be possible to change the fields of a class with the exception of primary key? My first attempt was…
-
0
votes2
answers112
viewsRest framework Django
Good evening, I was studying a bit of Rest framework on Jango and I developed a simple Api to consume with Angular went all right however my api I did is limited to { [ { "id":1, "name":"lima",…
-
0
votes1
answer280
viewsOverride Viewset POST action to save and update data in Django Rest Framework
I am creating an application for stock control and am having the following difficulty. When I enter a [product input] the input quantity must be added to the stock quantity of [product]. There is…
-
0
votes0
answers37
viewsI cannot see the database data in the Django-Rest-framework api
I’m trying to set up a chess board with Django Rest Framework, so I want only the positions to be loaded, but I always get returned only "None". This is because the last database records are…
-
0
votes0
answers88
views'Object of type 'type' has no Len()' in Django
I am trying to filter the data from a list between two dates and I received this error. Models py. class Data(models.Model): dev = models.ForeignKey(Device,…
-
0
votes1
answer21
viewsDjango Rest Framework does not filter after resetting queryset
My url will be something like.../? search=modal. I want to replace the "modal" with empty "" so that clean the filter and return all records. Views.py class…
-
0
votes0
answers17
viewsDjango Manytomany "needs to have a value for field "id" before this Many-to-Many Relationship can be used"
Hello, I’m trying to assign data in a model that contains a Manytomany field... Reading around I understood that first should instantiated the Model creating it and passing the data with exception…
-
0
votes0
answers7
viewsHow to filter a list of objects using another list of objects as reference in Django Rest Framework?
I have a User model, which are the users with access to the system, only that each user has to be registered in a work sector, I would like to filter and send via API the list of sectors that have…