Category "django"

understanding try except python/django

I need your help with understanding try-except python/Django. so I have this function: def submit_dept_head_application(request, application_id): cv = request.F

How can we add more than 3 authors field for a single magzine? in Django models

I created a magzine model in django. But their are more than three authors of a magzine. I have written below code for three authors. If I write the code of two

DRF --405 Method not allowed for update operation

I have done this before and may be it did work properly that time but now suddenly it's not working as it's expected to be. The viewset.py: class ProfileView

Images are not rendering on Django template from a multi-model view

Problem: I cannot get images to appear on my template plant_detail.html. I think I'm calling on variables incorrectly, but not sure what to change. Context: I c

Creating Custom Join in Django

I am struggling to create the correct prefetch behavior in Django. Here is the outline of the problem: Each Account has DailyQuotes, updated daily at different

Django. How to get URL by its name?

I want to get url by name specified in urls.py. Like {% url 'some_name' %} in template, but in Python. My urls.py: urlpatterns = [ ... path('admin_secti

How to change HTMX behavior to replace the full web page if form is invalid

If this form submits as invalid, I want to override the htmx and do a HttpRedirectResponse that refreshes the full page instead of just changing the div, #super

Vercel CLI Pyhon version issue when deploying Django project

When running the vercel command in Ubuntu terminal: Error! Command failed: python3.6 /tmp/2de7da56/get-pip.py --user ERROR: This script does not work on Pyth

Adding search bar function into a django project

I'm trying to add search bar in my application but I don't know how to query a database to gives the things that user's search for. I want when user search for

How to upload and use images on heroku django

so i make this app in which you can make products. And those products have an image that was saved in a file while i was using this app localy. I deployed my ap

ImportError: cannot import name 'url' from 'django.conf.urls'

ImportError: cannot import name 'url' from 'django.conf.urls' (/home/chams/pfe_project/CarApp/venv/lib/python3.8/site-packages/django/conf/urls/_init_.py) I can

In Django, how to restrict access to a template to users based on their department_name. Each user belongs to certain department

I have the below model. Departments, users. Users are assigned to a department. How can I restrict the access of templates based on the department_name of a use

calculate remaining import fields based on 2 import fields

I have a model with multiple fields. I want to make an importer (possibly with the django import-export library) that only takes two fields and with that calcul

Django with postgresql deployment on aws elastic beanstalk

I’ve been trying to deploy a django application with postgresql db on aws elastic beanstalk and i ran into many issues that i surfed and solved. Now the a

Django 404 error-page not found, how can I solve this problem?

My project is named main, and when I runserver I get this error.Anybody have any clue how to fix this error. Page not found (404) Request Method: GET Request UR

TypeError: 'module' object is not callable (+static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT))

here is my django project's urls.py from django.urls import path from .import views from django.conf import settings from django.conf.urls import static urlpa

How to connect Kafka consumer to Django app? Should I use a new thread for consumer or new process or new docker container?

I have Django app which should consume Kafka messages and handle it with my handlers and existing models. I use https://kafka-python.readthedocs.io/en/master/us

Django - Joining after filtering

Imagine there are a model and a view: class Task(models.Model): title = models.CharField(...) message = models.TextField(...) performer = models.For

White blank page when I deploy my (React.js & Django) app to Heroku

I'm beginner and the project works perfectly locally , but when I deploy on Heroku I get a blank page. I also connected my Heroku to GitHub and and I made a bui

Django admin: section in app without creating a model

I need a custom section of application on admin site. It must not consider any model (proxy, unmanaged, etc), without template overriding, just a "phantom" appl