From 38ccea0f1fc6f8479f7740a75d9514bf937474d0 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Wed, 16 Feb 2022 14:09:59 -0500 Subject: [PATCH] Fix up warnings - the default auto-increment primary key field type is now configurable, and Django's check command issues a warning if you are just assuming the historical behavior of using AutoField. - Django 3.2 brings in automatic AppConfig discovery, so all of our explicit `default_app_config = ...` assignments in __init__.py modules are no longer needed, and raise a RemovedInDjango41Warning. --- awx/conf/__init__.py | 2 -- awx/main/__init__.py | 2 -- awx/settings/defaults.py | 5 +++++ awx/sso/__init__.py | 2 -- awx/ui/__init__.py | 2 -- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/awx/conf/__init__.py b/awx/conf/__init__.py index 661295a685..3580b7a45a 100644 --- a/awx/conf/__init__.py +++ b/awx/conf/__init__.py @@ -7,8 +7,6 @@ from django.utils.module_loading import autodiscover_modules # AWX from .registry import settings_registry -default_app_config = 'awx.conf.apps.ConfConfig' - def register(setting, **kwargs): settings_registry.register(setting, **kwargs) diff --git a/awx/main/__init__.py b/awx/main/__init__.py index f500f439b6..e484e62be1 100644 --- a/awx/main/__init__.py +++ b/awx/main/__init__.py @@ -1,4 +1,2 @@ # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. - -default_app_config = 'awx.main.apps.MainConfig' diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index cab598cd81..b11710495e 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -41,6 +41,11 @@ else: DEBUG = True SQL_DEBUG = DEBUG +# FIXME: it would be nice to cycle back around and allow this to be +# BigAutoField going forward, but we'd have to be explicit about our +# existing models. +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', diff --git a/awx/sso/__init__.py b/awx/sso/__init__.py index bb4e958844..e484e62be1 100644 --- a/awx/sso/__init__.py +++ b/awx/sso/__init__.py @@ -1,4 +1,2 @@ # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. - -default_app_config = 'awx.sso.apps.SSOConfig' diff --git a/awx/ui/__init__.py b/awx/ui/__init__.py index ac6a554356..e484e62be1 100644 --- a/awx/ui/__init__.py +++ b/awx/ui/__init__.py @@ -1,4 +1,2 @@ # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. - -default_app_config = 'awx.ui.apps.UIConfig'