#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182de275bec-71f3d942-3401-4b0e-86e0-8e484f4776e5-000000%40eu-central-1.amazonses.com.

Reply via email to