From 6e6c892ec25e083d949f224b90d50dde20b55923 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Sun, 6 Sep 2020 17:41:18 +0200 Subject: [PATCH] Add migrations --- colleges/migrations/0016_populate_colleges.py | 11 +++++------ journals/migrations/0093_journal_college.py | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/colleges/migrations/0016_populate_colleges.py b/colleges/migrations/0016_populate_colleges.py index 7960d8059..b6e169d82 100644 --- a/colleges/migrations/0016_populate_colleges.py +++ b/colleges/migrations/0016_populate_colleges.py @@ -10,12 +10,11 @@ def populate_colleges(apps, schema_editor): College = apps.get_model('colleges.College') for af in AcademicField.objects.all(): - if af.name != 'Multidisciplinary': - college, created = College.objects.get_or_create( - name=af.name, - acad_field=af, - order=1 - ) + college, created = College.objects.get_or_create( + name=af.name, + acad_field=af, + order=1 + ) class Migration(migrations.Migration): diff --git a/journals/migrations/0093_journal_college.py b/journals/migrations/0093_journal_college.py index 12c1526aa..9be5d90a3 100644 --- a/journals/migrations/0093_journal_college.py +++ b/journals/migrations/0093_journal_college.py @@ -11,8 +11,10 @@ def populate_journal_college(apps, schema_editor): field_name = journal.name.split(' ')[1] if field_name != 'Selections': college = College.objects.get(name=field_name) - journal.college = college - journal.save() + else: + college = College.objects.get(name='Multidisciplinary') + journal.college = college + journal.save() class Migration(migrations.Migration): -- GitLab