0015_datamigration_lifelong.py 908 Bytes
Newer Older
1
2
3
4
5
6
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-13 21:36
from __future__ import unicode_literals

from django.db import migrations, models

Thom Wiggers's avatar
Thom Wiggers committed
7
8
import activemembers.models

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

def remove_enddates(apps, schema_editor):
    Board = apps.get_model("activemembers", "Board")
    CommitteeMembership = apps.get_model("activemembers", "CommitteeMembership")
    for board in Board.objects.all():
        for membership in CommitteeMembership.objects.filter(committee=board):
            membership.until = None
            membership.save()


class Migration(migrations.Migration):

    dependencies = [
        ('activemembers', '0014_committee_active'),
    ]

    operations = [
Thom Wiggers's avatar
Thom Wiggers committed
26
27
28
        migrations.AlterModelManagers(
            name='board',
            managers=[
29
                ('objects', models.manager.Manager()),
Thom Wiggers's avatar
Thom Wiggers committed
30
31
32
            ],
        ),
        migrations.RunPython(remove_enddates),
33
    ]