Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
1 replies
55 views

In Django / DRF, we can provide Prefetch, but is it the role of the serializer to have "good" datas. For example I have this basic code: from rest_framework import generics, serializers from ...
Ratinax's user avatar
  • 51
0 votes
0 answers
79 views

I have the following model: from django_resized import ResizedImageField class PostImage(models.Model): image = ResizedImageField( size=[1200, 1200], quality=85, upload_to=...
sodiumfish's user avatar
3 votes
0 answers
125 views

I have a custom User model with a role field and respective [Role]Profile models: class User(AbstractUser): role = models.CharField() # Other fields class TeacherProfile(models.Model): # ...
sodiumfish's user avatar
0 votes
0 answers
92 views

models.py class Post(models.Model): content = models.TextField() created = models.DateTimeField(auto_now_add=True) suspended = models.BooleanField(default=False) user = models.ForeignKey(User, ...
erkanunluturk's user avatar
Best practices
0 votes
0 replies
55 views

I have three networks; A, B, and C. A will contain all fields and will be the single source of truth. B will contain a couple of fields from A, and C will contain much less than A and B. A is the ...
user18715183's user avatar
Advice
3 votes
7 replies
262 views

I have some experience with Python, and I’m interested in backend development. Is Django still a good choice to learn in the current job market? I’m particularly interested in its relevance for modern ...
Ayob Bleblo's user avatar
1 vote
1 answer
99 views

I am creating an API with Django Rest Framework and I keep encoutering an issue where i am unable to pull a single item from my django model on the browser. I have two endpoints one that gets the ...
Zubair Amjad's user avatar
Advice
0 votes
5 replies
56 views

So i have a char field which i was using to store emails. Now there are some rule/validation and processes for email fields like email validation and email normalization etc. I have to add the ...
Abhishek's user avatar
1 vote
2 answers
117 views

I have this user model and in admin.py which of course is used by my client as admin page view and recently my client requested that the user/s who has been archived should not show in the active list ...
raza hussain's user avatar
0 votes
0 answers
127 views

I have "successfully" set up django-storages to work with our self hosted Minio instance. This is the settings for the setup: STORAGES = { "default": { "BACKEND&...
4bs3nt's user avatar
  • 90
1 vote
2 answers
81 views

Let's say this is my model: from django.core.exceptions import ValidationError class MyModel(models.Model): value = models.CharField(max_length=255) def clean(self): if self.value == &...
Farhad Mohammadi's user avatar
1 vote
1 answer
103 views

class Party(models.Model): user = models.ForeignKey( "user.User", on_delete=models.PROTECT, related_name="party" ) name = models.CharField(max_length=255) ...
rohit rasam's user avatar
0 votes
1 answer
108 views

I'm implementing JWT authentication using Django REST Framework and djangorestframework-simplejwt in my project. I have an endpoint for updating a category. What I tried Verified that the JWT token ...
Amirhosein Heidari's user avatar
Advice
0 votes
2 replies
51 views

Django's http response.py library provides an Http404 class that can be used to raise a "not found" exception which returns a 404 along with the following JSON payload: {"detail":&...
jpro's user avatar
  • 363
0 votes
0 answers
61 views

I have a Django Admin setup where a Marketing user should only be allowed to view Clients and Therapists. However, even after removing all permissions related to UserIncomeSupportDocument, the ...
Raza Khalid's user avatar
2 votes
1 answer
110 views

This import in urls.py... from drf_nested_routers import DefaultRouter as NestedDefaultRouter ...gives me an error: Import "drf_nested_routers" could not be resolved However, ...
Juan's user avatar
  • 11
-2 votes
1 answer
203 views

I am working with a DocuSign sandbox (developer) environment to integrate embedded signing and webhook functionality into a Django REST Framework application. Initially, I was able to send envelopes ...
K Vinay's user avatar
Best practices
1 vote
5 replies
184 views

I’m building a small “newsroom” application where Django handles the backend (API, authentication, admin) and Vue 3 handles the frontend UI. I’m still fairly new to combining Django with a modern ...
Random3c0d3's user avatar
-4 votes
2 answers
114 views

What is the difference between decorator @api_view and @csrf_exempt in project level django rest framework? I need the difference and which is better to develop the project.
Sanjay N's user avatar
1 vote
2 answers
83 views

I have a Django REST project where I created a directory called apps to store all my apps. Each app is added to the INSTALLED_APPS list in my settings file like this: INSTALLED_APPS = [ 'django....
Ali Motamed's user avatar
1 vote
1 answer
125 views

I'm encountering a persistent 403 Forbidden error with the detail: CSRF Failed: CSRF token missing. This happens when trying to obtain an authentication token using Django REST Framework's built-in ...
mohsen's user avatar
  • 11
2 votes
2 answers
85 views

I have a Django project with DjangoRestFramework. I have a simple view, Facility, which is a ListAPIView. Permissions were generated for add, change, delete and view. I have create a new user, and ...
Mathijs van Nimwegen's user avatar
0 votes
1 answer
71 views

I am making a back-end system using DRF in Django. This is my first project in Django and DRF. I am using Django purely as a REST back-end I am making a quiz/mcq application This is from my questions ...
Sam8848's user avatar
4 votes
1 answer
112 views

I am an intern at a company and we are using django as framework. I was working on a two part register system in which an admin performs the initial registration after which a link is sent to the user ...
Parsa Ghost's user avatar
-1 votes
1 answer
66 views

I was working on notion like app, so I have a Note (consider as a page in notion), and in that, I have blocks, where each block has a different id and held with note in foreign field so now in views ...
sbnd abhijeet's user avatar
0 votes
0 answers
66 views

I would like to ask about a certain topic that is tough one. Im working in a project that has microservices architecture with more than 1 databases running every time. in django, how can I perform ...
Ελευθέριος Μπάρμπας's user avatar
0 votes
1 answer
84 views

What are the details of your problem? I have a application in Django that is deployed using GKE. It uses an ingress to deploy it... Those manifests.yml that are used for deploying applications on ...
Raul Chiarella's user avatar
0 votes
1 answer
181 views

I have a serverless pipeline on Google Cloud. It consists of three total steps: A video uploader that sends videos to Google Cloud Storage. Working fine. An eventarc + pub/sub trigger that fires ...
Raul Chiarella's user avatar
1 vote
0 answers
44 views

I have a Django API that returns self signedup users in a given date range. The AuditLog model stores timestamp with DateTimeField(default=timezone.now) and USE_TZ=True. Locally, the date filter works ...
Manish Shrestha's user avatar
3 votes
1 answer
192 views

I have a very simple view that Streams a repsonse. When using python manage.py runserverthe stream works as expected. But, when we use uvicorn app.asgi:application or daphne app.asgi:application or ...
Diogo Dias's user avatar
0 votes
0 answers
106 views

I’m working with Django REST Framework and django-filter to implement API filtering. I created custom serializer fields (for example, a JalaliDateField that converts between Jalali and Gregorian dates,...
PooyaAbbasi's user avatar
0 votes
1 answer
145 views

Context: I'm setting DRF + dj-rest-auth + allauth + simple-jwt for user authentication. Desired behaviour: Register with no username, only email. Authorize login only if email is verified with a link ...
Oliver Mohr Bonometti's user avatar
-1 votes
0 answers
49 views

My backend has an endpoint: /auth/jwt/create that returns a JSON response containing the access and refresh tokens. With my current backend setup, I send the tokens in both the response body and in ...
sodiumfish's user avatar
0 votes
2 answers
312 views

In my React + Django project, I’m currently sending the refresh token as an HttpOnly cookie. The problem with HttpOnly cookies is that they are automatically sent by the browser, which makes them ...
Sibi K's user avatar
  • 9
0 votes
1 answer
200 views

I’m trying to apply custom throttling for the signup endpoint in my Django REST Framework API. The goal is to allow only 5 signup attempts per hour for anonymous users. I created a SignupRateThrottle ...
Adebola Ajewole's user avatar
-1 votes
1 answer
162 views

i am making an API with django rest framework and django 5.2 when i send a POST request, if i be logged in it gives me an CSRF token missing error. but if i be logged out it gives me response with no ...
parham ardeshiri's user avatar
0 votes
2 answers
458 views

For my Django projects, I am used to creating a custom user model and managing what my user can do for a specific route using a roles field like this: class User(AbstractBaseUser, PermissionsMixin): ...
Fazle Rabbi Faiyaz's user avatar
0 votes
1 answer
116 views

I have a Django 4.2 app with Postgres DB and REST API. My urls.py contains this path in urlpatterns: path('create/<int:pk>/<str:name>/', ComponentCreate.as_view(), name='create-component') ...
Paul Sandie's user avatar
1 vote
2 answers
114 views

I'm using Django and Stripe for a multi-tenant SaaS. I register users and organizations manually from a view, and I create the customer and subscription using Stripe API before saving to the database. ...
Br0k3nS0u1's user avatar
1 vote
0 answers
72 views

@transaction.atomic def deposit(user: User, account_number: str, amount: float) -> None: account = get_object_or_404( Account.objects.select_for_update(), account_number=account_number, ...
Jueun's user avatar
  • 11
-2 votes
1 answer
80 views

The backend works, when i test it with an http file. and directly at the endpoint. POST http://localhost:8000/api/products/ HTTP/1.1 Content-Type: application/json Authorization: Bearer ...
M.creations's user avatar
0 votes
2 answers
177 views

I am using the Django REST Framework with dj-rest-auth and django-allauth for authentication and authorisation with JWTs. From what I have heard, using HTTP-only cookies to store the tokens is a ...
Sebastian Power's user avatar
0 votes
0 answers
116 views

file models.py ANIMATIONS_ACTIONS = ( ('0', _('Stop animations')), ('1', _('Start animations')), ('2', _('Restart animations')), ('3', _('Suspend animations')), ('4', _('Unload ...
Franc SERRES's user avatar
0 votes
1 answer
108 views

Describe the Problem I have a ModelViewSet in Django REST Framework designed to return a list of Order objects. To improve performance, I'm trying to implement custom pagination that limits the ...
Raul Chiarella's user avatar
0 votes
2 answers
80 views

imagine i have a super simple serializer.py file : and i just want to use it ! nothing special .. so im going to write something like this (with a model class called "Product") & its ...
Human's user avatar
  • 27
2 votes
1 answer
48 views

The following example doesn't work as expected, and returns a validation error. Why is that? from rest_framework import serializers class TestSerializer(serializers.Serializer): from_field = ...
Pier1 Sys's user avatar
  • 1,320
1 vote
1 answer
51 views

Django Admin: How to combine archived_at and archive_status into one archival source? I’m building a feature to archive users via Django Admin. Currently, I’m using both a DateTimeField (archived_at) ...
raza hussain's user avatar
1 vote
1 answer
41 views

I have a rather simple backend and API with two user types, User and Admin. I have created groups and permissions in Django. The Admin should CRUD everything and the User should only view and edit ...
Daniel F.'s user avatar
  • 1,810
1 vote
2 answers
159 views

How to use CustomUser with dj_rest_auth to register with email and password. I have the source code below, but the username information is required during the sign-up process. I would like to know how ...
Tio's user avatar
  • 1,022
1 vote
1 answer
59 views

I have a problem creating a slug based on the title and pk, due to the use of parler. I'm using Parler for multilinguality in my API, and when I try to create a slug like title-pk I'm getting various ...
kryx's user avatar
  • 108

1
2 3 4 5
634