Update migration again

This commit is contained in:
Ramon Wenger 2021-08-31 14:01:48 +02:00
parent da7adcbb4c
commit fdd35301d9
1 changed files with 2 additions and 1 deletions

View File

@ -5,10 +5,11 @@ from django.db import migrations
def set_default_school_class(apps, schema_editor):
Project = apps.get_model('portfolio', 'Project')
User = apps.get_model('user', 'User')
projects = Project.objects.all()
bulk_projects = []
for project in projects:
owner = project.student
owner = User.objects.get(id=project.student.id)
selected_class = owner._get_selected_class()
if selected_class is not None:
project.school_class = selected_class