# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-15 19:17
from __future__ import unicode_literals

from django.db import migrations


def add_edit_time(apps, schema_editor):
    """ Add edit_time to all existing Article instances """
    Article = apps.get_model('helpcenter', 'Article')

    for article in Article.objects.all():
        if not article.time_edited:
            article.time_edited = article.time_published

        article.save()


class Migration(migrations.Migration):

    dependencies = [
        ('helpcenter', '0005_article_time_edited'),
    ]

    operations = [
        migrations.RunPython(add_edit_time),
    ]
