[Django] #33957: The "Save and ..." buttons in the admin panel stopped working

12 views
Skip to first unread message

Django

unread,
Aug 27, 2022, 3:15:01 AM8/27/22
to django-...@googlegroups.com
#33957: The "Save and ..." buttons in the admin panel stopped working
-----------------------------------------+------------------------
Reporter: Maxim K. | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
[https://youtu.be/uR9apBZPzjU Video]

Hello! The test was done on an empty project. Actually, I did not
understand at what point the problem occurs, but I will try to give enough
data, maybe it will help.

I noticed a problem in my new project and at first I thought that some
library could not work correctly with the new version of django. Then I
created an empty project and the problem happened again, BUT! This problem
does not always appear. I don't know exactly when, but two points that
sometimes triggered it:
1. Clear cache (ctrl+f5)
2. Deleting rows in the same table

In the developer console, I noticed that when submitting the form, only
the token and group name are sent, but the permissions and the button name
were not sent. This is probably why it does not save the resolution and
the behavior changes when saving.

The same problem was observed in the version of django 4.0, but there this
problem manifested itself less

Let me know what other information to provide?

Deploying a project using docker

{{{
FROM python:3.10-alpine
}}}


settings.py
{{{
from pathlib import Path
import os

BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get("SECRET_KEY")
DEBUG = int(os.environ.get("DEBUG", default=0))
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS",
default='*').split(" ")
__SSL_ON__ = int(os.environ.get("__SSL_ON__", default=0))

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'app.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'app.wsgi.application'

# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': os.environ.get('SQL_ENGINE',
'django.db.backends.sqlite3'),
'NAME': os.environ.get('SQL_DATABASE', BASE_DIR / 'db.sqlite3'),
'USER': os.environ.get('SQL_USER', 'user'),
'PASSWORD': os.environ.get('SQL_PASSWORD', 'password'),
'HOST': os.environ.get('SQL_HOST', 'localhost'),
'PORT': os.environ.get('SQL_PORT', '5432'),
}
}

# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-
validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME':
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME':
'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME':
'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME':
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = '/staticfiles/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static_files')]

MEDIA_URL = '/mediafiles/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'mediafiles')

if bool(__SSL_ON__):
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

if bool(DEBUG):
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

}}}


requirements.txt
{{{
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile
#
asgiref==3.5.2
# via django
django==4.0
# via -r requirements.in
gunicorn==20.1.0
# via -r requirements.in
psycopg2==2.9.3
# via -r requirements.in
sqlparse==0.4.2
# via django
unidecode==1.3.4
# via -r requirements.in

# The following packages are considered to be unsafe in a requirements
file:
# setuptools

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33957>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 27, 2022, 4:13:35 AM8/27/22
to django-...@googlegroups.com
#33957: The "Save and ..." buttons in the admin panel stopped working
-------------------------------+--------------------------------------

Reporter: Maxim K. | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Claude Paroz):

Might be related to #33893, do you have the opportunity to test with the
tip of the stable/4.1.x Django branch?

--
Ticket URL: <https://code.djangoproject.com/ticket/33957#comment:1>

Django

unread,
Aug 27, 2022, 5:14:16 AM8/27/22
to django-...@googlegroups.com
#33957: The "Save and ..." buttons in the admin panel stopped working
-------------------------------+--------------------------------------
Reporter: Maxim K. | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Maxim K.):

Replying to [comment:1 Claude Paroz]:


> Might be related to #33893, do you have the opportunity to test with the
tip of the stable/4.1.x Django branch?

Indeed, I did not find the problem on the proposed branch. At least with
several tests everything was in order. I'm really looking forward to the
new version! Because I edit some of the data through the admin panel and
this is a rather unpleasant phenomenon. Thank you for your work!

--
Ticket URL: <https://code.djangoproject.com/ticket/33957#comment:2>

Django

unread,
Aug 27, 2022, 8:17:39 AM8/27/22
to django-...@googlegroups.com
#33957: The "Save and ..." buttons in the admin panel stopped working
-------------------------------+--------------------------------------
Reporter: Maxim K. | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

Maxim, thanks for the confirmation.

Duplicate of #33893.

--
Ticket URL: <https://code.djangoproject.com/ticket/33957#comment:3>

Reply all
Reply to author
Forward
0 new messages