Questions tagged [django-2.2]

Django 2.2 is a version of the Django framework, released April 2019. It is a Long Term Support (LTS) release, and will be supported until at least April 2022. Please only use this tag if your question relates specifically to this version.

Django 2.2 works with Python 3.5, 3.6, 3.7, 3.8, and 3.9.

release notes

261 questions
14
votes
1 answer

Using SQLite3 with Django 2.2 and Python 3.6.7 on Centos7

I am moving my Django code from 2.1.7 directly to the new Django 2.2. The only problem I encountered in my Centos7 development environment was that my local development database (sqlite3) version was incompatible using my Python 3.6.7. The error I…
10
votes
3 answers

What is the value of self._db by default in Django?

Please see the following code: user.save(using=self._db) What is the default value of self._db for Django? Does this value default to what I've specified under default for database in my settings.py? I've found questions on Stack Overflow that…
user11719301
10
votes
1 answer

Django fails to model legacy database with inspectdb

I have a currently empty Geodjango app set up - I am connected to my Postgis database in which I have a table named aadf that I am attempting to create a model from. I am using inspectdb to do this. I get the following error message: from…
Jamie
  • 277
  • 4
  • 19
8
votes
2 answers

Unable to debug or use pdb in Django: bdb.BdbQuit

I'm using Django (2, 2, 4, 'final', 0) within a docker, but I'm able to bash inside to open or execute whatever is required. But I can't debug. (How to debug in Django, the good way? states some methods, none work for me) Within my views.py I'm…
Qohelet
  • 1,459
  • 4
  • 24
  • 41
8
votes
3 answers

Get the file size of the uploaded file in Django app

I would like show in the template the size of a file that the user have uploaded. I've see that the file object has the attribute size but, because I'm newbie with Python and the development field, I've been trouble to understand how I can use…
MaxDragonheart
  • 1,117
  • 13
  • 34
7
votes
1 answer

Django model objects became not hashable after upgrading to django 2.2

I'm testing the update of an application from Django 2.1.7 to 2.2.12. I got an error when running my unit tests, which boils down to a model object not being hashable : …
ptrico
  • 1,049
  • 7
  • 22
7
votes
1 answer

How to pass optional parameters in url, via path () function?

I'm confused about passing optional parameter via url in Django with path() instead of url(). I found that I should use kwargs, so I added it to path: path('all///', views.show_all_objects,…
MorganFreeFarm
  • 3,811
  • 8
  • 23
  • 46
7
votes
0 answers

Django: infinite loop in cleanse_setting

I am currently using Heroku CI to run my django tests: python3 manage.py test --fail-fast However upon running these on the heroku CI i get an infinite loop when the django system tries to render the settings: During handling of the above exception,…
Casper Bang
  • 793
  • 2
  • 6
  • 24
7
votes
2 answers

"No installed app with label 'admin'" in empty Django 2.2 project

I am starting a new project in Django 2.2 using the same commands as I always do: python3 -m venv django-env . django-env/bin/activate pip install django django-admin startproject mysite cd mysite/ python3 manage.py runserver 8080 This should…
Tommy
  • 1,006
  • 3
  • 13
  • 26
5
votes
1 answer

Database queries to 'cache' are not allowed in this test in django 2.2

I'm migrating project to django 2.2 from django 1.11. We have database based cache that runs on different database (not on default). When running tests, we get the following error: AssertionError: Database queries to 'cache' are not allowed in this…
eran
  • 6,731
  • 6
  • 35
  • 52
5
votes
3 answers

AttributeError: module 'profile' has no attribute 'run'

So I have an extended User model (extended AbstractUser) called Profile. This was in a seperate app called "profiles". I was plugging in the standard login and realised it was looking for a "profile" app name as standard, so I renamed it…
michjnich
  • 2,796
  • 3
  • 15
  • 31
4
votes
1 answer

I can't connect MySQL version 8 to Django 2.2 project

I have tried pretty much everything, including scouring StackOverflow to solve this issue yet I still seem to be faced with the problem. I am trying to connect my Django 2.2.6 project to my MySQL version 8 database with zero luck. I have changed…
CThomas
  • 199
  • 1
  • 10
4
votes
1 answer

Using Python 3.7 contextvars to pass state between Django views

I'm building a single database/shared schema multi-tenant application using Django 2.2 and Python 3.7. I'm attempting to use the new contextvars api to share the tenant state (an Organization) between views. I'm setting the state in a custom…
tunecrew
  • 888
  • 9
  • 13
4
votes
4 answers

Migrations error in django 2; AttributeError: 'str' object has no attribute 'decode'

I am running migrations on my newly built app called 'core'. When I run migrations on it, I get an error that tells me this; query = query.decode(errors='replace') AttributeError: 'str' object has no attribute 'decode' I am posting the Traceback…
obadul024
  • 163
  • 1
  • 1
  • 13
4
votes
1 answer

How to fix ‘AttributeError: cffi library '_constant_time' has no function, constant or global variable named '__spec__'’ error in django”

I want to import requests lib (in views.py)to request some information from the other website. but there is a error like title in ivews.py from django.http import HttpResponse from django.http import JsonResponse from django.core import…
y.zhang
  • 41
  • 3
1
2 3
17 18