<filename>circles/migrations/0014_auto_20200506_2128.py
# Generated by Django 3.0.6 on 2020-05-06 19:28

from django.conf import settings
from django.db import migrations, models


def create_through_relations(apps, schema_editor):
    Event = apps.get_model("circles", "Event")
    Participation = apps.get_model("circles", "Participation")
    for event in Event.objects.all():
        for participant in event.participants.all():
            Participation.objects.get_or_create(user=participant, event=event)


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("circles", "0013_auto_20200506_2117"),
    ]

    operations = [migrations.RunPython(create_through_relations)]

<filename>circles/migrations/0014_auto_20200506_2128.py
# Generated by Django 3.0.6 on 2020-05-06 19:28

from django.conf import settings
from django.db import migrations, models


def create_through_relations(apps, schema_editor):
    Event = apps.get_model("circles", "Event")
    Participation = apps.get_model("circles", "Participation")
    for event in Event.objects.all():
        for participant in event.participants.all():
            Participation.objects.get_or_create(user=participant, event=event)


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("circles", "0013_auto_20200506_2117"),
    ]

    operations = [migrations.RunPython(create_through_relations)]

# Generated by Django 3.0.6 on 2020-05-06 19:28