Adapt to Django 6.1: compat app config, django.contrib.postgres

This commit is contained in:
sajeyks 2026-10-06 13:56:47 +03:00
commit 5e4ce6713b
2 changed files with 19 additions and 0 deletions

View file

@ -55,3 +55,20 @@ if not hasattr(models, 'NullBooleanField'):
if not hasattr(HttpRequest, 'is_ajax'):
HttpRequest.is_ajax = lambda self: self.headers.get('x-requested-with') == 'XMLHttpRequest'
from django.apps import AppConfig
class CompatConfig(AppConfig):
"""Shims that need the app registry; listed first in INSTALLED_APPS so
they are in place before the admin modules of other apps are imported."""
name = 'dynamicweb'
label = 'dynamicweb_compat'
def ready(self):
from django.contrib.admin import options
from django.contrib.auth import admin as auth_admin
if not hasattr(auth_admin, 'csrf_protect_m'):
auth_admin.csrf_protect_m = options.csrf_protect_m

View file

@ -92,6 +92,7 @@ if not SECRET_KEY:
# Application definition
INSTALLED_APPS = (
'dynamicweb.compat.CompatConfig',
# 1st migrate
'membership',
'djangocms_admin_style',
@ -103,6 +104,7 @@ INSTALLED_APPS = (
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.postgres',
'multisite',
'easy_thumbnails',
'utils',