33 lines
928 B
Python
33 lines
928 B
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.11.1 on 2017-12-01 18:01
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def forward(apps, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
Volunteer = apps.get_model("cfp", "Volunteer")
|
|
for volunteer in Volunteer.objects.using(db_alias).all():
|
|
for activity in volunteer.old_activities.all():
|
|
volunteer.activities.add(activity)
|
|
|
|
|
|
def backward(apps, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
Activity = apps.get_model("cfp", "Activity")
|
|
for activity in Activity.objects.using(db_alias).all():
|
|
for volunteer in activity.volunteers.all():
|
|
activity.old_volunteers.add(volunteer)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('cfp', '0022_auto_20171201_1800'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(forward, backward),
|
|
]
|