Completed
Push — master ( 836a98...37dfd2 )
by
unknown
44s
created

update_channels()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.9.6 on 2017-07-10 11:13
3
from __future__ import unicode_literals
4
5
from django.db import migrations
6
from crash.utils import get_channel
7
8
def update_channels(apps, schema_editor):
9
    Crash = apps.get_model("crash", "Crash")
10
    crashes = Crash.objects.all().exclude(build_number='')
11
    crashes = crashes.exclude(os='').iterator()
12
    for obj in crashes:
13
        obj.channel = get_channel(obj.build_number, obj.os)
14
        obj.save()
15
16
17
class Migration(migrations.Migration):
18
19
    dependencies = [
20
        ('crash', '0031_crash_channel'),
21
    ]
22
23
    operations = [
24
        migrations.RunPython(
25
            update_channels,
26
            reverse_code=migrations.RunPython.noop
27
        ),
28
    ]
29