Category "django"

Catch exception on save in Django admin?

I have a pre_save signal handler on a bunch of models, which write to a different database. If something goes wrong, I'd like to abort the whole save, or faili

django-debug-toolbar not showing up

I looked at other questions and can't figure it out... I did the following to install django-debug-toolbar: pip install django-debug-toolbar added to middlew

How to get a model's last access date in Django?

I'm building a Django application, and in it I would like to track whenever a particular model was last accessed. I'm opting for this in order to build a user

Django send_mail not working - No email delivered

When the view that sends the email is used nothing happens, i then entered send_mail(...) into the python shell and it returned 1 but i didn't receive any email

mssql isn't an available database backend or couldn't be imported

I'm following this guide. Mssql-django and I have Django version 3.2.12 I already installed mssql-django 1.1.1 I also have pyodbc 4.0.32 modified my settings.py

Django Testing - SimpleCookie and Session

Problem: My testing client appears to log out once i attempt to set a cookie. I have workspace (project) object that i want my client to access. The access itse

path of STATICFILES_DIRS in django

I am from PHP background and want to give path to STATICFILES_DIRS in settings.py and in windows I understand that I will need to give full path like: D:/path

Django Programming error column does not exist even after running migrations

I run python manage.py makemigrations and I get: No changes detected Then, python manage.py migrate and I get: No migrations to apply. Then, I try to p

How to use chained django_select2 selects in django admin panel?

I took almost unchanged guide from documentation there is my models.py from django.db import models class Country(models.Model): name = models.CharField(m

'NOT NULL constraint failed' after adding to models.py

I'm using userena and after adding the following line to my models.py zipcode = models.IntegerField(_('zipcode'), max_length

Django OAuth Toolkit and POSTMAN

I made a django OAuth server using Django OAuth Toolkit. I've setup the code right and when I use CURL in the following way: curl -X POST -d "grant_type=passw

How to change the parameter dynamically in pd.DateOffset in python code?

date_ranges_values = request.POST['range'] ft = [df.index[-1] + DateOffset(date_ranges_values = lambda x:x) for x in range(0, 24))] Suppose I get value in

How to upload a database on Kiwi TCMS from json file?

I have kiwi TCMS on docker through docker-compose.yml. And i have file json with database (old version of kiwi) To dump database from old serwer i use: docker

Django CheckConstraint: Elements of reverse ForeignKey lookup must not be empty

I've got these models: class Container(models.Model): ... class Meta: constraints = [ models.CheckConstraint( chec

how can I export multiple images using zipfile and urllib2

I am trying to add multiple image files into my zip. I have searched around and knows how to add a single one. I tried to loop through multiple images then wri

How to change the validation error color and position in Django?

I am new to Django. I am trying to make a simple form to match the password. However, when I enter different passwords and press the Save button I get a black v

django - get 'REMOTE_USER' from middleware class

We use kerberos for our authentication. Using request.META['REMOTE_USER'] I am able to get the authenticated user in my views.py however when I move this to

Run script python in web browser

I have a script python for Reading biometric identity card with a card reader this script use this https://github.com/roeften/pypassport, i want to creat a web

Run script python in web browser

I have a script python for Reading biometric identity card with a card reader this script use this https://github.com/roeften/pypassport, i want to creat a web

Facing this issue with creating a superuser

While trying to execute this command: (venv) sreekarsiddula@Sreekars-MacBook-Air bidgala % /Users/sreekarsiddula/piapps/venv/bin/python3 manage.py createsuperus