# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-27 15:32
from __future__ import unicode_literals

from datetime import timedelta
from django.conf import settings
from django.db import migrations, models

DELTA = timedelta(seconds=settings.HOOVER_TWOFACTOR_INVITATION_VALID)


def forward(apps, schema_editor):
    Invitation = apps.get_model('twofactor', 'Invitation')
    for invitation in Invitation.objects.all():
        invitation.expires += DELTA
        invitation.save()


def reverse(apps, schema_editor):
    Invitation = apps.get_model('twofactor', 'Invitation')
    for invitation in Invitation.objects.all():
        invitation.expires -= DELTA
        invitation.save()


class Migration(migrations.Migration):

    dependencies = [
        ('twofactor', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='invitation',
            name='generated',
            field=models.DateTimeField(),
        ),
        migrations.RenameField(
            model_name='invitation',
            old_name='generated',
            new_name='expires',
        ),
        migrations.RunPython(forward, reverse),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-27 15:32
from __future__ import unicode_literals

from datetime import timedelta
from django.conf import settings
from django.db import migrations, models

DELTA = timedelta(seconds=settings.HOOVER_TWOFACTOR_INVITATION_VALID)


def forward(apps, schema_editor):
    Invitation = apps.get_model('twofactor', 'Invitation')
    for invitation in Invitation.objects.all():
        invitation.expires += DELTA
        invitation.save()


def reverse(apps, schema_editor):
    Invitation = apps.get_model('twofactor', 'Invitation')
    for invitation in Invitation.objects.all():
        invitation.expires -= DELTA
        invitation.save()


class Migration(migrations.Migration):

    dependencies = [
        ('twofactor', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='invitation',
            name='generated',
            field=models.DateTimeField(),
        ),
        migrations.RenameField(
            model_name='invitation',
            old_name='generated',
            new_name='expires',
        ),
        migrations.RunPython(forward, reverse),
    ]

# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-27 15:32