#33957 closed Bug (duplicate)

The "Save and ..." buttons in the admin panel stopped working

Reported by: Maxim K. Owned by: nobody
Component: contrib.admin Version: 4.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (3)

comment:1 by Claude Paroz, 20 months ago

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

in reply to:  1 comment:2 by Maxim K., 20 months ago

Replying to 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!

comment:3 by Mariusz Felisiak, 20 months ago

Resolution: duplicate
Status: newclosed

Maxim, thanks for the confirmation.

Duplicate of #33893.

Note: See TracTickets for help on using tickets.
Back to Top