diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/app_template/apps.py-tpl | 1 | ||||
| -rw-r--r-- | django/conf/global_settings.py | 2 | ||||
| -rw-r--r-- | django/conf/project_template/project_name/settings.py-tpl | 5 | ||||
| -rw-r--r-- | django/db/backends/postgresql/features.py | 9 | ||||
| -rw-r--r-- | django/db/models/base.py | 33 |
5 files changed, 10 insertions, 40 deletions
diff --git a/django/conf/app_template/apps.py-tpl b/django/conf/app_template/apps.py-tpl index b705352181..9b2ce5289c 100644 --- a/django/conf/app_template/apps.py-tpl +++ b/django/conf/app_template/apps.py-tpl @@ -2,5 +2,4 @@ from django.apps import AppConfig class {{ camel_case_app_name }}Config(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' name = '{{ app_name }}' diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 3d4c6f4a5f..77f2b83e68 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -436,7 +436,7 @@ DEFAULT_TABLESPACE = "" DEFAULT_INDEX_TABLESPACE = "" # Default primary key field type. -DEFAULT_AUTO_FIELD = "django.db.models.AutoField" +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" # Default X-Frame-Options header value X_FRAME_OPTIONS = "DENY" diff --git a/django/conf/project_template/project_name/settings.py-tpl b/django/conf/project_template/project_name/settings.py-tpl index 5631ec9a31..c2d24e4df0 100644 --- a/django/conf/project_template/project_name/settings.py-tpl +++ b/django/conf/project_template/project_name/settings.py-tpl @@ -115,8 +115,3 @@ USE_TZ = True # https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/ STATIC_URL = 'static/' - -# Default primary key field type -# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#default-auto-field - -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py index 83e6b5cf7f..419fad8686 100644 --- a/django/db/backends/postgresql/features.py +++ b/django/db/backends/postgresql/features.py @@ -123,6 +123,15 @@ class DatabaseFeatures(BaseDatabaseFeatures): "test_group_by_nested_expression_with_params", } ) + if not is_psycopg3: + expected_failures.update( + { + # operator does not exist: bigint[] = integer[] + "postgres_tests.test_array.TestQuerying.test_gt", + "postgres_tests.test_array.TestQuerying.test_in", + "postgres_tests.test_array.TestQuerying.test_lt", + } + ) return expected_failures @cached_property diff --git a/django/db/models/base.py b/django/db/models/base.py index 7c20319da6..3827b00346 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1701,7 +1701,6 @@ class Model(AltersData, metaclass=ModelBase): *cls._check_indexes(databases), *cls._check_ordering(), *cls._check_constraints(databases), - *cls._check_default_pk(), *cls._check_db_table_comment(databases), *cls._check_composite_pk(), ] @@ -1709,38 +1708,6 @@ class Model(AltersData, metaclass=ModelBase): return errors @classmethod - def _check_default_pk(cls): - if ( - not cls._meta.abstract - and cls._meta.pk.auto_created - and - # Inherited PKs are checked in parents models. - not ( - isinstance(cls._meta.pk, OneToOneField) - and cls._meta.pk.remote_field.parent_link - ) - and not settings.is_overridden("DEFAULT_AUTO_FIELD") - and cls._meta.app_config - and not cls._meta.app_config._is_default_auto_field_overridden - ): - return [ - checks.Warning( - f"Auto-created primary key used when not defining a " - f"primary key type, by default " - f"'{settings.DEFAULT_AUTO_FIELD}'.", - hint=( - f"Configure the DEFAULT_AUTO_FIELD setting or the " - f"{cls._meta.app_config.__class__.__qualname__}." - f"default_auto_field attribute to point to a subclass " - f"of AutoField, e.g. 'django.db.models.BigAutoField'." - ), - obj=cls, - id="models.W042", - ), - ] - return [] - - @classmethod def _check_composite_pk(cls): errors = [] meta = cls._meta |
