0015_datamigration_lifelong.py 709 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
# -*- 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


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 = [
        migrations.RunPython(remove_enddates)
    ]