diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a39be07e..6c65e4d5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -56,6 +56,7 @@ Changed - Reformat with black v24.3.0 (#1374) - Update download URL in ``get_chromedriver_url.py`` (#1385) - Add ``AUTH_LDAP_USER_SEARCH_BASE`` as a Django setting (#1410) + - Change ``ATOMIC_REQUESTS`` recommendation and default to ``True`` (#1281) - **Filesfolders** - Add migration required by Django v4.2 (#1396) - Add app specific media type and versioning (#1278) diff --git a/config/settings/base.py b/config/settings/base.py index b53eff36..160b1818 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -154,7 +154,7 @@ DATABASES = { 'default': env.db('DATABASE_URL', default='postgres:///sodar_core') } -DATABASES['default']['ATOMIC_REQUESTS'] = False +DATABASES['default']['ATOMIC_REQUESTS'] = True # Set default auto field (for Django 3.2+) DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' diff --git a/docs/source/app_projectroles_settings.rst b/docs/source/app_projectroles_settings.rst index 3d51e9e1..03e50342 100644 --- a/docs/source/app_projectroles_settings.rst +++ b/docs/source/app_projectroles_settings.rst @@ -69,16 +69,14 @@ following apps need to be included in the list in order for SODAR Core to work: Database ======== -Under ``DATABASES``, the setting below is recommended: +Under ``DATABASES``, we recommend setting ``ATOMIC_REQUESTS`` to ``True`` as in +the following sample. This ensures transactions to be atomic on a view-level. +It is still possible to ensure atomicity of specific blocks of code with +Django's ``transaction.atomic`` decorator or context manager. .. code-block:: python - DATABASES['default']['ATOMIC_REQUESTS'] = False - -.. note:: - - If this conflicts with your existing set up, you can modify the code in your - other apps to use e.g. ``@transaction.atomic``. + DATABASES['default']['ATOMIC_REQUESTS'] = True Templates