Questions tagged [django-4.1]

Django 4.1 is the latest version of the Django framework, released in August 2022. Please only use this tag if your question relates specifically to this version.

Django 4.1 works with Python 3.8, 3.9, 3.10, and 3.11.

Here are some of the salient features of Django 4.1:

Django 4.1 was released in August 2022 and is supported until December 2023.

41 questions
5
votes
1 answer

Too many db connections (django 4.x / ASGI)

I have deployed a django app (on ASGI using uvicorn) and getting a lot of OperationalError FATAL: sorry, too many clients already It seems that this is a known issue #33497 for django 4.x and ASGI, but I cant find anything on it (other than…
fekioh
  • 894
  • 2
  • 9
  • 22
2
votes
0 answers

Django admin button for fields to trigger action

In the Django admin change form of my model I would like to be able to add a button next to any field. Clicking this button should call some function with the current form data as input. Once the function returns, the Django admin form should be…
2
votes
1 answer

ImportError: cannot import name 'KeyTextTransform' from 'django.contrib.postgres.fields.jsonb'

What is the new import for: ImportError: cannot import name 'KeyTextTransform' from 'django.contrib.postgres.fields.jsonb' I did some internet searching and didn't find an immediate result for the error. I am trying to upgrade from django 3.2 to…
jmunsch
  • 22,771
  • 11
  • 93
  • 114
1
vote
2 answers

Could not parse the remainder: '{%get(gender='F')%}.fullname' from 'x.parent.{%get(gender='F')%}.fullname'

I have a problem with getting a data in template. I am writing code in python file its working. students = Student.objects.all() for x in students: print(x.parent.get(gender='M').fullname) It gets me Parent Fullname, but when i write it in…
rowsen
  • 65
  • 4
1
vote
0 answers

Django 4.1 : bulk_create() can only be used with concrete fields in update_fields

I try to use the new arguments updata_fields and unique_fields in Django 4.1, but I realy don't know what to do about this error... Here is my model : class Sequence(models.Model): id = models.CharField(max_length=50, primary_key=True) …
AxlLvy
  • 11
  • 4
1
vote
2 answers

The view post.views.view didn't return an HttpResponse object. It returned None instead

I want to create a new post using PostCreateView and go to the details page of the new post in the next step, but I get this error: (The view post.views.view didn't return an HttpResponse object. It returned None instead.) views class…
miyankouh
  • 35
  • 5
1
vote
0 answers

Django rest API : Python command-line .py execution: Stuck at a certain place

I'm trying to deploy the following Django-rest api on gcp ubuntu 22.0.4 using python 3.9. https://github.com/OkunaOrg/okuna-api The entire setup is supposed to be done and get setup using a single command : python3.9 okuna-cli.py up-full The…
Earthling
  • 83
  • 3
  • 13
1
vote
1 answer

the user created in the admin panel cannot log in to the admin panel

I have a custom user model: class CustomUser(AbstractUser): ACCESS_LEVELS = ( ('user', 'Авторизованный пользователь'), ('admin', 'Администратор') ) email = models.EmailField( max_length=254, unique=True, …
lev_k
  • 25
  • 3
1
vote
3 answers

Django Standalone Script in Django 4.1

I am trying to run a standalone script in django 4.1. I have the setup as suggested in this post at the top of my file: Django Standalone Script import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "path_to_settings.settings") import…
bballboy8
  • 400
  • 6
  • 25
1
vote
0 answers

Django 4 Logout Show error after pressing Logout Button

Got the error on pressing Logout Button- @login_required def logout_user(request): logout(request) return HttpResponseRedirect(reverse('app_login:login')) error :ValueError at /accounts/logout/ The view django.contrib.auth.logout didn't…
1
vote
1 answer

Django-->TypeError: __init__() got an unexpected keyword argument 'providing_args'

I'm running my django-app-api server on docker and I'm stuck at a particular place. The server doesnt spawn due to the following error : TypeError: init() got an unexpected keyword argument 'providing_args' I'm getting the following error trace…
Earthling
  • 83
  • 3
  • 13
1
vote
1 answer

Starting In django 4.1, the auth LogoutView requires a POST (not a GET) request: Is there a built-in form so I can get the CSRF?

As of Aug 23, 2022 (20 days after 4.1 release), google search could not find the answer...! So, asking on SO.
TaiwanGrapefruitTea
  • 1,045
  • 2
  • 14
  • 25
1
vote
1 answer

hasattr(value, "contribute_to_class") returns KeyError: 'contribute_to_class' (Django 4.1)

A Django 1.1 / Python 2.7 project that I'm attempting to run on Python 3.10 / Django 4.1. A Python related error (i.e. old import) or a django code error (i.e. missing field that's now mandatory) pops up, I fix it and rerun. The current error,…
Jay
  • 2,535
  • 3
  • 32
  • 44
0
votes
1 answer

Django running async code in WSGI mode causes SynchronousOnlyOperation error

Our Django 4.1 website is running on a WSGI server. We are not ready to convert the entire website to ASGI but we rewrote an io-intensive operation in asyncio mode and called it in the view function as follows: async def utility_func(urls): …
user2283347
  • 670
  • 8
  • 12
0
votes
0 answers

Error on testcase after update from django 2 to 4

I'm updating my entire project from Django 2.2 to Django 4.2.3. I have already read the entire deprecation timeline and done regression tests, and everything is working. But, using the TestCase, I found a difference: tear_down isn't flushing the…
Luid Duarte
  • 111
  • 4
1
2 3