@@ -0,0 +1,1344 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2020-07-17 08:37%0Afrom __future__ import unicode_literals%0A%0Afrom django.core.exceptions import ObjectDoesNotExist%0Afrom django.db import migrations, models, connection%0Afrom django.utils.translation import activate, _trans%0Afrom tenant_extras.middleware import tenant_translation%0Afrom parler.models import TranslatableModelMixin%0A%0A%0Adef remove_old_statistic_block_from_homepage(apps, schema_editor):%0A    StatsContent = apps.get_model('cms', 'StatsContent')%0A    ContentType = apps.get_model('contenttypes', 'ContentType')%0A%0A    for stats_content in StatsContent.objects.all():%0A        if stats_content.placeholder and stats_content.placeholder.parent_type.model == 'homepage':%0A            print stats_content%0A            stats_content.stats.all().delete()%0A            with connection.cursor() as c:%0A                c.execute(%0A                    'delete from contentitem_cms_statscontent where contentitem_ptr_id = %7B%7D;'.format(%0A                        stats_content.contentitem_ptr_id%0A                    )%0A                )%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A    dependencies = %5B%0A        ('cms', '0061_auto_20200812_1030'),%0A    %5D%0A%0A    operations = %5B%0A        migrations.RunPython(%0A            remove_old_statistic_block_from_homepage,%0A            migrations.RunPython.noop%0A        )%0A    %5D%0A

Add migration that deletes old statscontent objects from homepage