From 34e9d01050b05587181c17ff2276b7cde57545c6 Mon Sep 17 00:00:00 2001 From: Josh Yu Date: Wed, 20 Nov 2024 16:16:16 +0800 Subject: [PATCH] fix: migration file --- CHANGELOG.rst | 1 + .../migrations/0002_migrate_locked_by.py | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a87630e..ea1b6ae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Changelog Unreleased ========== * Dropped Support for Python 3.8 +* Dropped Support for Django CMS < 4.1 * Introduced Django CMS 4.1 support. * delete `VersionLock` as It's moved to Version.locked_by field. * monkeypatch `ChangeListActionsMixin` in cms.admin.utils to support action list burger menu. diff --git a/djangocms_version_locking/migrations/0002_migrate_locked_by.py b/djangocms_version_locking/migrations/0002_migrate_locked_by.py index 9036c2f..f9f2502 100644 --- a/djangocms_version_locking/migrations/0002_migrate_locked_by.py +++ b/djangocms_version_locking/migrations/0002_migrate_locked_by.py @@ -1,6 +1,6 @@ # Generated by Django 4.2.8 on 2024-11-07 07:21 -from django.db import migrations, transaction +from django.db import migrations def forwards(apps, schema_editor): @@ -11,10 +11,8 @@ def forwards(apps, schema_editor): version_lock_qs = VersionLock.objects.using(db_alias).all() versions = set(Version.objects.using(db_alias).filter(pk__in=version_lock_qs.values('version'))) - with transaction.atomic(): - for version in versions: - version.locked_by = version.versionlock.created_by - + for version in versions: + version.locked_by = version.versionlock.created_by Version.objects.using(db_alias).bulk_update(versions, ['locked_by'])