Category "django"

A MultiSelectField with a select2 widget is not properly working for EDIT in Django

I have a form I am trying to understand its behaviour in Django. The form code looks like : class RequestForm(forms.ModelForm): TIMEPOINTS = (

Private Object Field in Django Admin

I'm wondering what the best way to have an editable field (by admins) for some object in Django admin that can't be viewable on the public site. For example, a

How to restart Dramatiq in Windows on code update or server restart?

I am using Django-Dramatiq with Dramatiq and RabbitMQ. I have it all working, but I am not sure the proper way to deploy to a Windows Server. If the server re

'RegisterAPI' should either include a `serializer_class` attribute, or override the `get_serializer_class()` method

I am trying to display a register_view here and I'm getting the error. I have made some changes to the views fil,e but i am still getting the errors and i don't

Not all files called with django static appear

I have index.html file in template file and I have js, css, image, files in my static file. I am writing the codes correctly, but the site does not appear prope

Issue with Django logout URL redirection

I have configured login and logout redirect setting in Django settings as below - LOGOUT_REDIRECT_URL = '/login/' LOGIN_REDIRECT_URL = '/locations/' However,

django ajax project- basket - collecting values in array

in my Django store I have a basket which in views.py has the class: class BasketAddView(View): def post(self, request, *args, **kwargs): basket = B

PasswordResetDoneView not using custom template in Django

PasswordResetDoneView.as_view is not loading custom template I'm using Django 2.2 version I have created a custom template and add the path to accounts app url

Django Not Found: /assets/js/main.js How Can I Solve this?

This is the error I am facing Not Found: /assets/vendor/venobox/venobox.css Not Found: /assets/vendor/boxicons/css/boxicons.min.css Not Found: /assets/vendor/ow

Trying To Retrieve Name Instead of Primary Key, But Django Rest Framework complains of Value Error. If I try to fix it, I got other errors too

My Models: def upload_to(instance, filename): return 'images/{filename}'.format(filename=filename) class StreamPlatform(models.Model): name = m

difference between Response and HttpResponse django

What is the difference between Response and HttpResponse in django? I am a bit confused. from rest_framework.response import Response Return Respose and from d

Django form doesn't send POST request and site freezes

I'm trying to set up a basic forum site for my coworkers to use. The problem is that when I attempt to log in to the site, no POST request is sent (shown by the

Django post-office setup

Perhaps it is just because I've never set up an e-mail system on Django before, or maybe I'm missing it... but does anyone have any insight on how to properly c

How to write sql COALESCE in Django

I'm new to Django. How to write COALESCE sql queryset in to django orm. query = 'SELECT COALESCE(max(CAST(order_no as UNSIGNED)), 0) as o,id from nanossc_Sales

Django How to Upload an Image to Form

This is my code associated with the form: # models class Date(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) place

Can't connect to Postgres from Django using a connection service file (on Windows)

[NOTE: This is using Django 4.0.2, Python 3.8.2, and Postgres 14.2.] I have successfully set up Django and Postgres, and I can get them to work together when I

Why does django wizard form not submit when one form is passed through get_form function?

I'm creating an app containing 3 multiple choice questions. The second multiple choice options are dependent on the response to the first question. To accomplis

Django - Cancel one delivery but when cancelling one it cancels all the deliveries

I'm trying to cancel one "posted" delivery when the user clicks on the button "cancel", but it cancels all the posted deliveries below is the views.py . views d

Get the selected radio button in django template

In my template I have for loop. As you can see the id for each radiobutton is represented by {{stud.id}} . {{stud.nameAndSurname}} shows the name and the surnam

TypeError: Object of type Cart is not JSON serializable

I just started using session in Django framework. I have create an object cart from Cart model. And when i wan to set cart inside request.session with session['