Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
34 views

I am studying the Django REST framework and building an API, but I have a simple question: Where should I add my validation fields? What’s the best place to do that—models or serializers? I know that ...
Marcos Ribeiro Morais's user avatar
0 votes
0 answers
51 views

I am trying to get the choice labels from a field that stores an array of choices - I am able to get the label when the field has a single value. Here is the model: class TobaccoUse(models.Model): ...
Eric J.'s user avatar
  • 548
-1 votes
1 answer
68 views

I am using pandas openpyxl to read excel file in my project. After reading the excel file I end up with list of dictionaries. These dictionaries have keys such as "Year 2024", "Range&...
Burakhan Aksoy's user avatar
0 votes
1 answer
45 views

I want to serializer a list of dicts that contain a whitespace. Obviously I can't write cat name = serializer.Charfield(...) in Python (see the space between the and cat). So, I tried source=, but I ...
PythonForEver's user avatar
0 votes
2 answers
58 views

I have minimal experience with Python, and no experience with Django, but I have been tasked with fixing a bug in a Django app. I have the following models class SurveyResponse(models.Model): ...
Bryce Bangerter's user avatar
0 votes
1 answer
55 views

In Django, I have the following model: class business(models.Model): business_category = models.ForeignKey(businessCategory, related_name='businesss', on_delete=models.CASCADE) partner1 = ...
Nht_e0's user avatar
  • 156
0 votes
2 answers
61 views

I’m working on a Django project using Django Rest Framework (DRF), and I’m facing issues with serializing and deserializing nested data for my Child model. Here’s a summary of my setup and the problem:...
Yaghi's user avatar
  • 33
4 votes
0 answers
89 views

I ran into a problem in postman that was not there until yesterday when I was working with it and it was working fine, but now it is not working anymore. I'm trying to create a user using djoser ...
kimiya's user avatar
  • 41
0 votes
1 answer
39 views

I have a Club Model as well as an Address model. class Club(models.Model): name = models.CharField(max_length=100) owner = models.ForeignKey(UserAccount,on_delete=models.CASCADE,related_name = ...
Evren Bingøl's user avatar
-3 votes
1 answer
80 views

I'm trying to implement a simple validator for my POST parameters My input looks like this: { "gage_id": "01010000", "forcing_source":"my_source", "...
Peter Kronenberg's user avatar
0 votes
1 answer
40 views

I'm encountering issues when trying to create a task with subtasks and users in my Django application. The task creation fails due to validation errors, specifically with the subtasks and users fields....
coder's user avatar
  • 715
1 vote
1 answer
87 views

I am new to the DRF framework, and am building a small project. I want to create a User instance (the built-in one) and while doing so also make a Seller instance linked to it during a user signup. ...
Ritwik Gupta's user avatar
0 votes
1 answer
52 views

I have two models, one like this: class PhysicalSensor(models.Model): name = models.CharField(unique=True, max_length=255) def __str__(self) -> str: return self.name class Sensor(...
parsariyahi's user avatar
0 votes
1 answer
33 views

I have two models named Market, Exchange class Exchange(models.Model): name = models.CharField(max_length=20) class Market(models.Model): exchange = models.ForeignKey(Exchange, on_delete=...
Hero's user avatar
  • 178
2 votes
1 answer
41 views

I am trying to use Django, DRF, ViewSet and Serializers to build a simple weblog. I have a main app and inside it: main\models.py: from django.db import models from django.contrib.auth.models import ...
Reza Amya's user avatar
  • 1,764
1 vote
1 answer
70 views

I have a User model and a UserProfile model with a one-to-one relationship. I'm using a serializer to create users, and I want to automatically create a corresponding UserProfile object for each user ...
nima_ shadloo's user avatar
2 votes
2 answers
46 views

I'm recently approaching drf and I want to create a system that returns a user's information. Among the various fields, the user has an avatar which should return the URL of the photo where it is ...
Giacomo Torbidoni's user avatar
0 votes
0 answers
66 views

I am using axios to get some data from my backend API made with django. Something very very wired is happening and I have been debugging this for hours. This is the axios function that gets the data: ...
Alkid Baci's user avatar
0 votes
2 answers
110 views

I have the following models in my django rest framework app: class Question(models.Model): class Type(models.TextChoices): TEXT = 'text', 'text question' RADIO = 'radio', 'choosing ...
Gosha's user avatar
  • 3
0 votes
0 answers
38 views

I am trying to serialize a geometry dict which also contains a location dict and map that dictionaries values to my model. The data comes in two levels deep and is mapped to a single model, because ...
JayaAnim's user avatar
  • 108
1 vote
0 answers
50 views

I have a sample table below with a parent-child relationship. id parent 1 null 2 1 3 2 4 null I have to represent this in the UI as a tree structure. What is or are the best approaches to this? Do I ...
Groot's user avatar
  • 19
0 votes
1 answer
66 views

I am trying to use Django-rest as an api for a front end in astro, the think is I am finding a problem when doing my post: {'items': [ErrorDetail(string='This field is required.', code='required')]} ...
David Florez Mazuera's user avatar
0 votes
1 answer
160 views

I see in a bunch of django code, especially in viewsets, that when serializer is initialized like the following: class UserViewSet(viewsets.ModelViewSet): """ A viewset that ...
bohorqux1996's user avatar
0 votes
1 answer
56 views

Here inside the serializer using to_representation, validate to remove the instance that doesn't satisfy the condition "completed == total_videos" but gets all the instances, so please ...
user15361826's user avatar
0 votes
0 answers
117 views

I have this model structure: class Main (models.Model): name=models.Charfield(max_length=50) ... class Category (Main): type=models.Charfield(max_length=50) ... class SubCategory1(...
javistro's user avatar

1
2 3 4 5
39