Commit 110aa63f authored by Michal Čihař's avatar Michal Čihař

Migrate project owner to owners list

Issue #719
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent ae8554af
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def fill_in_owners(apps, schema_editor):
Project = apps.get_model('trans', 'Project')
for project in Project.objects.all():
if project.owner:
project.owners.add(project.owner)
def fill_in_owner(apps, schema_editor):
Project = apps.get_model('trans', 'Project')
for project in Project.objects.all():
if project.owners.exists():
project.owner = project.owners.all()[0]
project.save()
class Migration(migrations.Migration):
dependencies = [
('trans', '0037_auto_20150810_1348'),
]
operations = [
migrations.RunPython(
fill_in_owners,
reverse_code=fill_in_owner,
),
]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment