From f17df1aebc56b63371a6a2c84eb0eaccb9823eca Mon Sep 17 00:00:00 2001 From: Andrew Aikman Date: Thu, 23 Dec 2021 14:39:17 +0000 Subject: [PATCH] Handle no users set test error --- .../migrations/0008_url_manager_data_migration.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/djangocms_url_manager/migrations/0008_url_manager_data_migration.py b/djangocms_url_manager/migrations/0008_url_manager_data_migration.py index 14a25b7..e07b7c1 100644 --- a/djangocms_url_manager/migrations/0008_url_manager_data_migration.py +++ b/djangocms_url_manager/migrations/0008_url_manager_data_migration.py @@ -34,7 +34,10 @@ def forwards(apps, schema_editor): url_queryset = Url.objects.all() - if djangocms_versioning_config_enabled and djangocms_versioning_installed: + # Only set the additional user etc if + # - versioning is enabled + # - there is url data, test suites fail when empty if not + if djangocms_versioning_config_enabled and djangocms_versioning_installed and len(url_queryset): # Get a migration user. migration_user = User.objects.get(id=DJANGOCMS_URL_MANAGER_VERSIONING_MIGRATION_USER_ID) Version = apps.get_model('djangocms_versioning', 'Version')