46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.7 on 2017-06-12 02:45
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def forwards(apps, schema_editor):
|
|
floors = {
|
|
# id, meeting, name, short
|
|
1: ("Berlin Intercontinental Floor 1", "1"),
|
|
2: ("Berlin Intercontinental Floor 2", "2"),
|
|
3: ("Berlin Intercontinental Floor 14", "14"),
|
|
4: ("Seoul Conrad Floor 3", "3"),
|
|
5: ("Seoul Conrad Floor 5", "5"),
|
|
6: ("Seoul Conrad Floor 6", "6"),
|
|
7: ("Chicago Swissotel Ballroom Level", "BL"),
|
|
8: ("Chicago Swissotel Concourse Level", "CC"),
|
|
9: ("Chicago Swissotel Floor 2", "2"),
|
|
10:("Chicago Swissotel Floor 3", "3"),
|
|
}
|
|
FloorPlan = apps.get_model('meeting', "FloorPlan")
|
|
for f in FloorPlan.objects.all():
|
|
name, short = floors[f.pk]
|
|
assert f.name == name, ("Unexpected floorplan name. Expected '%s' for FlooPlan#%s, found '%s' in the database"%(name, f.id, f.name))
|
|
f.short = short
|
|
f.save()
|
|
|
|
def backwards(apps, schema_editor):
|
|
pass
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('meeting', '0051_auto_20170511_0449'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='floorplan',
|
|
name='short',
|
|
field=models.CharField(default=b'', max_length=2),
|
|
),
|
|
migrations.RunPython(forwards, backwards),
|
|
]
|