I have a GeoDjango (v5.2) model ("Location") with a MultiPolygonField ("coordinates") and use PostGIS (v17-3.5) as database backend. When I annotate a queryset with the multi-polygon's centroid, I get slightly different results compared to the centroid method of a single …
I am working on Django project. I have a user_signup page where users can create an account. When I click Create an Account, and when i create it with users informations , instead of showing "signed up successfully" I get …
I'm trying to implement a custom WebDav server in Django and when I try to open a document in Microsoft Word using Microsoft's Office URI, it always opens in read-only mode. In my OPTIONS endpoint I'm returning the needed headers …
I wanted to create a edit profile page and along with the usercreationform fields wanted to add extra fields like phone no and data and use a one to one relation with the model having extra infos models.py class Profile(models.Model): …
I have many picos controlling sensors on my network. I want to generate unique MAC addresses for them (using the unique ID) so I can keep them organized in my Postgres database which is controlled by django. Right now everything …
I am building my first production-ready pharmacy website using Django. The backend will be used to manage products, inventory, orders, and users. I am considering using Django’s built-in Admin interface for internal management instead of building a custom dashboard from …
I am building a Django website where I use HTMX to load partial HTML content when clicking navbar links (instead of full page reloads). The navbar itself is not supposed to change, only the main content area is swapped using …
I am looping around a cart dictionary that is in the session and I have defined a product for all the items. When each cart item button is clicked, they are sent via ajax, but only the first item is …
I’m working on a web dashboard where users need to play large MP4 videos (around 300–400 MB) directly in the browser and switch between videos quickly (different users/patients). I noticed that if an MP4 doesn’t have the moov atom at …
I wrote ajax for django to add products to cart, I use internal js which runs but when I put that code in external js file it doesn't work, Although I received the ID and csrf_token. html <main …
I am attempting to migrate model changes I have made to my codebase to a PostgreSQL server (PostgreSQL 18.1 on x86_64-linux, compiled by gcc-11.4.0, 64-bit), but every time I do this error is thrown. Specifically, the migrate sequence throws the …
I am trying to download an Excel file (.xlsx) using an HTMX request in a Django application. The request is triggered correctly, and the response is returned from the server, but the downloaded Excel file is either corrupted or opens …
As a beginner in Django, I am confused about which frontend technology to use for handling dynamic behavior. Should I start with: plain JavaScript, AJAX, or a library like jQuery? Which one has a smoother …
I'm new to Django. I've been making a project with 3 types of accounts: Schools, professors and users. But I feel like some things would be too "repetitive" like some model fields and views the views. I thought that having …
(venv) PS C:\poultry_link\poultrylink> npx tailwind css init npm error could not determine executable to run npm error A complete log of this run can be found in: C:\Users\naallah\AppData\Local\npm-cache\_logs\2026-01-02T11_39_06_488Z-debug-0.log
I have a survey app that works fine as a standalone app with no complaints (using sqlite). But when I incorporate the survey app into another that is using postgres as a database, it fails to run the survey app's …
I have a survey app that works fine as a standalone app with no complaints (using sqlite). But when I incorporate the survey app into another that is using postgres as a database, it fails to run the survey app's …
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": "storages.backends.s3.S3Storage", "OPTIONS": { "endpoint_url": os.getenv("MINIO_ENDPOINT_URL"), "access_key": os.getenv("MINIO_ACCESS_KEY"), "secret_key": os.getenv("MINIO_SECRET_KEY"), "bucket_name": os.getenv("MINIO_BUCKET_NAME"), …
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 == "bad": raise ValidationError("bad value") def save(self): self.full_clean() return super().save() And I have this serializer: from …
Problem I am working on a Django project using a PostgreSQL container in Docker. I added a ManyToManyField to one of my models. I keep migrations in .gitignore because my local and production databases are different, so I only pushed …
I'm attempting to display a form for a tennis event (location, time/date) and each of its participants (name, status). I was recommended to use an inlineformset, which I assume would allow editing of all those fields with one submit button. …
I added following and followers by using intermediate model, it`s ok but does not correctly specify objects in the intermediate model. I expect the user who follows must to be in the user_from field and the one who followed to …
I'm getting the above error while executing the following method in my django rest framework project (Django==5.0.4, djangorestframework==3.16.1). def activate( self, subscription_date=None, mark_transaction_paid=True, no_multiple_subscription=False, del_multiple_subscription=False, ): if no_multiple_subscription: self.deactivate_previous_subscriptions(del_multiple_subscription=del_multiple_subscription) current_date = subscription_date or timezone.now() next_billing_date = self.plan_cost.next_billing_datetime(current_date) self.active = …
I am calling the LinkedIn organizationPageStatistics endpoint using the REST.li 2.0 API, but I keep getting a 400 PARAM_INVALID error related to the timeIntervals parameter. According to the official documentation (li-lms-2025-11), timeIntervals is an object, not a list. Error response …
Only Experts Can Answer this question. Which one is best for 2026 Python developers , Python Data science or Python Django? From both of these which one is easy to learn and high paid?
I am conducting an academic research study focused on comparing Code First (CF) and Database First (DBF) approaches in different ORMs. The goal of this survey is to collect objective, experience-based input from developers who have worked in real-world projects. …
Выдает такую вот ошибку, в чем дело? RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported. warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning) вот мой код в файле models.py: …
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 is valid. Confirmed that the user is is_staff=True and …
While trying to create a custom QuerySet and a custom Manager for a django Model I stumbled upon the documentation sections 1 and 2 that use the manager's _db property and i would like …
I’m running a Django (ASGI) app on Heroku using Gunicorn with the Uvicorn worker to support WebSockets. Heroku has a hard 30-second request timeout. When a request exceeds 30 seconds, Heroku closes the connection as expected. Problem: Even after the …
I am implementing the Wright inbreeding coefficient (F) for individuals in a pigeon pedigree (Django application, relational database). The current implementation builds the pedigree using a breadth-first search (BFS) up to a fixed number of generations and computes F using …
I have done the guide and yet i still cannot get it to work correctly. These two screenshots are the closest i have come to success attempt1 attempt2 This is how …
I’m building a Django-based classifieds website. Previously, my search form populated districts and categories using database queries like: districts = ( AdPost.objects .filter(admin_verified=True) .values_list("district", flat=True) .distinct() ) To improve consistency and performance, I’ve now moved both district and category to …
I'd like to change background color for these headers for different color (not white): Like this: My models: from django.core.validators import MinValueValidator, MaxValueValidator from django.db import …
I have models: from django.db import models class Request(models.Model): class Method(models.TextChoices): POST = "POST", "POST" GET = "GET", "GET" PUT = "PUT", "PUT" DELETE = "DELETE", "DELETE" method = models.CharField( max_length=10, choices=Method, default=Method.GET, ) url = models.TextField() class Response(models.Model): request …
I am using django-tenants and created various aliases that all point to localhost. If the local development server is reachable via http://localhost:8000/ and I can login to the admin as expected. If I use e.g. http://other_url.local:8000/django-admin the …
I'm trying to add a row to my model, but it keeps coming back with: django.db.utils.ProgrammingError: relation "qmgr_def_rules" does not exist LINE 1: SELECT 1 AS "a" FROM "qmgr_def_rules" WHERE "qmgr_def_rules"... Some context: I have 3 different applications under …
In my django project admin I have an Order model. I display a bunch of information in the change page with the help of custom inlines. As I use a lot of related models, I want to …
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":"Not found."}. However there are no other HTTP error response classes that …
So I'm building a webhook functionality for a particular Django model, as in I trigger the webhooks for 2 events. One is for creation and one for modification, as in I wanna trigger them everytime an object of that model …