Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Aug 20, 2024
1 parent cdefeff commit 4b91439
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions djangocms_text/migrations/0003_auto_20240702_1409.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.25 on 2024-07-02 14:09

from django.db import connection, migrations, models
from django.db import migrations, models


def migrate_text_ckeditor_fields(apps, schema_editor):
Expand All @@ -20,14 +20,14 @@ class Meta:
json = models.JSONField(blank=True, null=True)
rte = models.CharField(max_length=16, blank=True)

if CKEditorText._meta.db_table in connection.introspection.table_names():
if CKEditorText._meta.db_table in schema_editor.connection.introspection.table_names():
existing_texts = Text_Text.objects.all().values_list("cmsplugin_ptr_id", flat=True)
qs = CKEditorText.objects.using(schema_editor.connection.alias).exclude(cmsplugin_ptr_id__in=existing_texts)
Text_Text.objects.using(schema_editor.connection.alias).bulk_create(
Text_Text(body=ckeditor_text.body, rte="text_ckeditor4", cmsplugin_ptr_id=ckeditor_text.cmsplugin_ptr_id)
for ckeditor_text in qs
)


class Migration(migrations.Migration):

Expand Down

0 comments on commit 4b91439

Please sign in to comment.