<filename>cpdb/cms/migrations/0007_faqpage_order_data.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-01-10 03:32
from __future__ import unicode_literals

from django.db import migrations


def populate_initial_order_data(apps, schema_edior):
    FAQPage = apps.get_model('cms', 'FAQPage')
    order = 0
    for page in FAQPage.objects.all().order_by('created'):
        page.order = order
        order += 1
        page.save()


class Migration(migrations.Migration):

    dependencies = [
        ('cms', '0006_faqpage_order'),
    ]

    operations = [
        migrations.RunPython(populate_initial_order_data),
    ]
