41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.1 on 2016-10-19 11:41
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def migrate_durations(apps, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
Event = apps.get_model('proposals', 'Event')
|
|
for event in Event.objects.all():
|
|
if event.duration < 0:
|
|
event.duration = 0
|
|
event.save()
|
|
Talk = apps.get_model('proposals', 'Talk')
|
|
for talk in Talk.objects.all():
|
|
if talk.duration < 0:
|
|
talk.duration = 0
|
|
talk.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('proposals', '0021_auto_20161016_2121'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(migrate_durations),
|
|
migrations.AlterField(
|
|
model_name='event',
|
|
name='duration',
|
|
field=models.PositiveIntegerField(default=0, verbose_name='Default duration (min)'),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='talk',
|
|
name='duration',
|
|
field=models.PositiveIntegerField(default=0, verbose_name='Duration (min)'),
|
|
),
|
|
]
|