0010_3_user_foreign_keys.py 665 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-10-12 10:28
from __future__ import unicode_literals

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


def forward_func(apps, schema_editor):
    MailingList = apps.get_model('mailinglists', 'MailingList')

    for mailinglist in MailingList.objects.all():
        for member in mailinglist.members_old.all():
            mailinglist.members.add(member.user)


class Migration(migrations.Migration):

    dependencies = [
        ('mailinglists', '0010_2_user_foreign_keys'),
    ]

    operations = [
        migrations.RunPython(
            code=forward_func,
        ),
    ]