From e82200bd6844c8b9e6f0f7ef3e2e808fd7533b31 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 15 Oct 2025 10:52:10 -0400 Subject: [PATCH 1/2] INTPYTHON-789 Document how to configure contrib apps with models --- docs/howto/contrib-apps.rst | 14 ++++++++++++++ docs/intro/configure.rst | 2 ++ 2 files changed, 16 insertions(+) diff --git a/docs/howto/contrib-apps.rst b/docs/howto/contrib-apps.rst index 7f4a0a01b..38b5ae8a3 100644 --- a/docs/howto/contrib-apps.rst +++ b/docs/howto/contrib-apps.rst @@ -5,6 +5,20 @@ Configuring Django's contrib apps Generally, Django's contribs app work out of the box, but here are some required adjustments. +Apps with models +================ + +Each contrib app that has models that use :class:`~django.db.models.AutoField` +(:mod:`~django.contrib.admin`, :mod:`~django.contrib.auth`, +:mod:`~django.contrib.contenttypes`, :mod:`~django.contrib.flatpages`, +:mod:`~django.contrib.redirects`, and :mod:`~django.contrib.sites`) must: + +#. Be configured with an ``AppConfig`` that specifies + ``default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField"``. + See :ref:`specifying the-default-pk-field`. +#. Have migrations that use :class:`.ObjectIdAutoField`. See + :ref:`configuring-migrations`. + ``contrib.sites`` ================= diff --git a/docs/intro/configure.rst b/docs/intro/configure.rst index 9aebcc030..d915547da 100644 --- a/docs/intro/configure.rst +++ b/docs/intro/configure.rst @@ -53,6 +53,8 @@ Each app reference in the :setting:`INSTALLED_APPS` setting must point to the corresponding ``AppConfig``. For example, instead of ``'django.contrib.admin'``, the template uses ``'.apps.MongoAdminConfig'``. +.. _configuring-migrations: + Configuring migrations ====================== From 84dc005ed5c216ef7a156d1655bc96ac66bb0bfb Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 24 Oct 2025 12:39:18 -0400 Subject: [PATCH 2/2] Fix typo in docs/howto/contrib-apps.rst --- docs/howto/contrib-apps.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/contrib-apps.rst b/docs/howto/contrib-apps.rst index 38b5ae8a3..c899b0673 100644 --- a/docs/howto/contrib-apps.rst +++ b/docs/howto/contrib-apps.rst @@ -2,7 +2,7 @@ Configuring Django's contrib apps ================================= -Generally, Django's contribs app work out of the box, but here are some +Generally, Django's contrib apps work out of the box, but here are some required adjustments. Apps with models