SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 6e6c892e authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add migrations

parent da7e15ff
No related branches found
No related tags found
No related merge requests found
...@@ -10,12 +10,11 @@ def populate_colleges(apps, schema_editor): ...@@ -10,12 +10,11 @@ def populate_colleges(apps, schema_editor):
College = apps.get_model('colleges.College') College = apps.get_model('colleges.College')
for af in AcademicField.objects.all(): for af in AcademicField.objects.all():
if af.name != 'Multidisciplinary': college, created = College.objects.get_or_create(
college, created = College.objects.get_or_create( name=af.name,
name=af.name, acad_field=af,
acad_field=af, order=1
order=1 )
)
class Migration(migrations.Migration): class Migration(migrations.Migration):
......
...@@ -11,8 +11,10 @@ def populate_journal_college(apps, schema_editor): ...@@ -11,8 +11,10 @@ def populate_journal_college(apps, schema_editor):
field_name = journal.name.split(' ')[1] field_name = journal.name.split(' ')[1]
if field_name != 'Selections': if field_name != 'Selections':
college = College.objects.get(name=field_name) college = College.objects.get(name=field_name)
journal.college = college else:
journal.save() college = College.objects.get(name='Multidisciplinary')
journal.college = college
journal.save()
class Migration(migrations.Migration): class Migration(migrations.Migration):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment