0003_auto_20160301_2032.py 475 Bytes
Newer Older
Okhin's avatar
Okhin committed
1
2
3
4
5
6
7
8
9
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models

def archive_old(apps, schema_editor):
    Violation = apps.get_model("bt", "Violation")

    for violation in Violation.objects.all():
Okhin's avatar
Okhin committed
10
11
        violation.old = True
        violation.save()
Okhin's avatar
Okhin committed
12
13
14
15
16
17
18
19
20
21

class Migration(migrations.Migration):

    dependencies = [
        ('bt', '0002_violation_old'),
    ]

    operations = [
            migrations.RunPython(archive_old),
    ]