# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 09:08
from __future__ import unicode_literals

from django.db import migrations


def copy_groups(apps, schema_editor):
    Group1 = apps.get_model('entities.Group')
    Group2 = apps.get_model('groups.Group')
    for g in Group1.objects.all():
        g2 = Group2.objects.create(
                name=g.name,
                slug=g.slug,
                address=g.address,
                avatar=g.avatar,
                avatar_color=g.avatar_color,
                date_founded=g.date_founded,
                description=g.description,
                logo=g.logo,
                url=g.url,
                closed=g.closed)
        g2.date_created = g.date_created
        g2.slug = g.slug
        g2.save()


class Migration(migrations.Migration):

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

    operations = [
        migrations.RunPython(copy_groups)
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 09:08
from __future__ import unicode_literals

from django.db import migrations


def copy_groups(apps, schema_editor):
    Group1 = apps.get_model('entities.Group')
    Group2 = apps.get_model('groups.Group')
    for g in Group1.objects.order_by('id'):
        g2 = Group2.objects.create(
                name=g.name,
                slug=g.slug,
                address=g.address,
                avatar=g.avatar,
                avatar_color=g.avatar_color,
                date_founded=g.date_founded,
                description=g.description,
                logo=g.logo,
                url=g.url,
                closed=g.closed)
        g2.date_created = g.date_created
        g2.slug = g.slug
        g2.save()


class Migration(migrations.Migration):

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

    operations = [
        migrations.RunPython(copy_groups)
    ]

Order groups by id when copying
Order groups by id when copying
