Conditions | 3 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Generated by Django 2.2.9 on 2020-01-29 15:30 |
||
6 | def forwards_func(apps, schema_editor): |
||
7 | # We get the model from the versioned app registry; |
||
8 | # if we directly import it, it'll be the wrong version |
||
9 | |||
10 | Animal = apps.get_model( |
||
11 | "uid", |
||
12 | "Animal") |
||
13 | |||
14 | Sample = apps.get_model( |
||
15 | "uid", |
||
16 | "Sample") |
||
17 | |||
18 | db_alias = schema_editor.connection.alias |
||
19 | |||
20 | # Update animal and sample |
||
21 | for animal in Animal.objects.using(db_alias).filter( |
||
22 | alternative_id="fixme"): |
||
23 | animal.alternative_id = animal.name |
||
24 | animal.save() |
||
25 | |||
26 | for sample in Sample.objects.using(db_alias).filter( |
||
27 | alternative_id="fixme"): |
||
28 | sample.alternative_id = sample.name |
||
29 | sample.save() |
||
30 | |||
47 |