Write data migration for ohlhafv challenges
This commit is contained in:
@@ -15,4 +15,4 @@ class PresetRoleTranslationOptions(TranslationOptions):
|
||||
class CustomRoleTranslationOptions(TranslationOptions):
|
||||
""" Class for CustomROle translation options"""
|
||||
|
||||
fields = ()
|
||||
fields = ()
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11 on 2018-01-28 21:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def migrate_ohlhafv(apps, schema_editor):
|
||||
NewOhlhafvChallenge = apps.get_model('ohlhafv', 'OhlhafvChallenge')
|
||||
OldOhlhafvChallenge = apps.get_model('webapp', 'OhlhafvChallenge')
|
||||
for challenge in OldOhlhafvChallenge.objects.all():
|
||||
NewOhlhafvChallenge.objects.create(
|
||||
id=challenge.id,
|
||||
challenger=challenge.challenger,
|
||||
victim=challenge.victim,
|
||||
challenger_email=challenge.challenger_email,
|
||||
victim_email=challenge.victim_email,
|
||||
series=challenge.series,
|
||||
message=challenge.message,
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('webapp', '0039_delete_kaehmy_models'),
|
||||
('ohlhafv', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migrate_ohlhafv),
|
||||
]
|
||||
+1
-1
@@ -8,7 +8,7 @@ from django.db import migrations
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('webapp', '0039_delete_kaehmy_models'),
|
||||
('webapp', '0040_migrate_ohlhafvchallenge'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
Reference in New Issue
Block a user