diff options
| author | Tom Forbes <tom@tomforb.es> | 2020-07-12 13:59:57 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-12-15 11:25:46 +0100 |
| commit | b5e12d490af3debca8c55ab3c1698189fdedbbdb (patch) | |
| tree | 5fe3005ac567f3addf78b81ae033191e2fa642f4 /django/apps/config.py | |
| parent | b960e4ed722a04a9db0d35293f76e253eedf9126 (diff) | |
Fixed #31007 -- Allowed specifying type of auto-created primary keys.
This also changes the default type of auto-created primary keys
for new apps and projects to BigAutoField.
Diffstat (limited to 'django/apps/config.py')
| -rw-r--r-- | django/apps/config.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/django/apps/config.py b/django/apps/config.py index 928e19ac44..6d794eee3a 100644 --- a/django/apps/config.py +++ b/django/apps/config.py @@ -5,6 +5,7 @@ from importlib import import_module from django.core.exceptions import ImproperlyConfigured from django.utils.deprecation import RemovedInDjango41Warning +from django.utils.functional import cached_property from django.utils.module_loading import import_string, module_has_submodule APPS_MODULE_NAME = 'apps' @@ -55,6 +56,15 @@ class AppConfig: def __repr__(self): return '<%s: %s>' % (self.__class__.__name__, self.label) + @cached_property + def default_auto_field(self): + from django.conf import settings + return settings.DEFAULT_AUTO_FIELD + + @property + def _is_default_auto_field_overridden(self): + return self.__class__.default_auto_field is not AppConfig.default_auto_field + def _path_from_module(self, module): """Attempt to determine app's filesystem path from its module.""" # See #21874 for extended discussion of the behavior of this method in |
