311,535 questions
1
vote
1
answer
49
views
Django Can't find table during insert: LINE 1: SELECT 1 AS "a" FROM "qmgr_def_rules" WHERE "qmgr_def_rules"
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 "...
1
vote
1
answer
33
views
Django admin update get_queryset only for "change" view
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 prefetch/select the ...
Advice
0
votes
0
replies
18
views
Why does Django Http404 return a JSON payload while all other Http error responses don't?
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":&...
-1
votes
0
answers
43
views
Dealing with m2m changes in Django on object save
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 ...
0
votes
1
answer
56
views
How to make django textfield required
I'm somehow unable to make the field required, setting null and blank to True has no effect.
# models.py
from django.db import models
class ExampleModel(models.Model):
text_field = models....
-4
votes
0
answers
66
views
How to insert single <li>? [closed]
I am trying to handle multi-level menu with AlpineJS. Is it posible to insert single <ul> (or </li>) in the code below?
<template x-if="item.has_children">
<!-- ...
1
vote
0
answers
85
views
Celery crashes when PgBouncer closes idle connections (idle timeouts enabled)
I’m encountering an issue when running Celery with PgBouncer and PostgreSQL after enabling idle connection timeouts.
My stack includes:
Django (served via Tornado)
Celery (workers + beat)
...
1
vote
1
answer
90
views
Django Deployment on Render: ModuleNotFoundError for WSGI Application The Problem
Demo of the Project
The Problem
I am attempting to deploy a Django portfolio project to Render. While the project runs perfectly on my local machine using python manage.py runserver, the deployment ...
2
votes
0
answers
81
views
"No module named django_heroku" (or django_on_heroku) error
I'm trying to install OWASP PyGoat, and then create a secure version of it. I followed method 2 on the repository's site (https://github.com/adeyosemanputra/pygoat?tab=readme-ov-file#method-2), but ...
0
votes
1
answer
67
views
Couldn't connect Railway volume with my Django project [duplicate]
In settings.py, I've added:
if os.environ.get("MOUNT_MEDIA"):
MEDIA_ROOT = "/app/media"
print("Using Railway mounted volume for MEDIA_ROOT")
else:
MEDIA_ROOT =...
-1
votes
0
answers
81
views
How to set table column width to django admin list_display? [closed]
I want the column foo (TextField, 2500 chars) to have a width of 30% in the Django admin view.
However, whatever I try, the columns widths remain equal (50% / 50%).
td.field-foo {width: 30%;} has no ...
0
votes
1
answer
87
views
How to see changes in django admin base.css
I want to change some css in static/admin/css/base.css
After attempting some changes on base.css without any effect, I now fail to understand the static-file concept at all.
As a matter of fact I can ...
2
votes
1
answer
62
views
Django / Serializer - How to pass label attached to choice field in API?
I am trying to get the label attached to the relevant interger for the choice field. Although the API returns the interger, I cannot seem to be able to return the actual label value.
This is the ...
0
votes
0
answers
77
views
optimization django admin panel queries with select_related and prefetch_related
These are my django models (only the FK s are written)
class SellerBuyable(TimeStampMixin, GBSoftDeleteModel):
seller = models.ForeignKey(Seller,related_name="seller_buyables",on_delete=...
0
votes
1
answer
65
views
How to mock django timezone.now in a abstract model
I'm unable to mock timezone.now in the model's created field. The test fails due unmocked/current datetime.
I tried patch('django.utils.timezone.now') to no avail.
# app/models.py
from django.utils ...