SciPost Code Repository

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

Add migration to populate College model

parent e4bc61b2
No related branches found
No related tags found
No related merge requests found
# Generated by Django 2.2.11 on 2020-09-06 05:16
from django.db import migrations
from ontology.models import AcademicField
def populate_colleges(apps, schema_editor):
AcademicField = apps.get_model('ontology', 'AcademicField')
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
)
class Migration(migrations.Migration):
dependencies = [
('colleges', '0015_auto_20200906_0714'),
]
operations = [
migrations.RunPython(populate_colleges,
reverse_code=migrations.RunPython.noop),
]
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