From e9b3f08ef3a6e47195a48b00ea21ad6e8d9c905f Mon Sep 17 00:00:00 2001 From: Ben Timby Date: Fri, 2 Feb 2024 14:17:13 -0500 Subject: [PATCH 1/2] Add documentation about default app config. --- README.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.rst b/README.rst index f02aad7..3b5aeec 100644 --- a/README.rst +++ b/README.rst @@ -206,6 +206,19 @@ Care must be given, as this will alter ALL models in your project. Usually you w Also, since this changes the auto-generated field, only global settings will be used for that field. If you desire specific settings for different models, then using this setting is not advised. +Django may configure the per-app `default_auto_field` when a new app is created. This will prevent the global setting +from taking affect. If you are attempting to use the global setting, you should check your app configs in +`project/app_name/apps.py` to ensure they don't interfere. + +.. code-block:: python + from django.apps import AppConfig + + + class ScheduleConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'schedule' + + Global Settings --------------- From b9f55d835558847ddbdbef4b45eda93aae967c31 Mon Sep 17 00:00:00 2001 From: Ben Timby Date: Fri, 2 Feb 2024 14:18:54 -0500 Subject: [PATCH 2/2] Fix formatting. --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 3b5aeec..e74ebbd 100644 --- a/README.rst +++ b/README.rst @@ -211,6 +211,7 @@ from taking affect. If you are attempting to use the global setting, you should `project/app_name/apps.py` to ensure they don't interfere. .. code-block:: python + from django.apps import AppConfig