<commit_before># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models

class Migration(DataMigration):

    def forwards(self, orm):
        for section in orm.section.objects.filter(title='Immunization Schedule for 2013'):
            subsection = orm.subsection.objects.filter(section=section)
            question_grids = orm.questiongroup.objects.filter(subsection__section=section, hybrid=True, grid=True, parent=None)
            question_groups = question_grids[1]
            next_order = section.sub_sections.count() + 1
            new_subsection = orm.subsection.objects.create(section=section, order=next_order, is_core=subsection[0].is_core, region=subsection[0].region)
            print new_subsection.id
            question_groups.subsection = new_subsection
            question_groups.save()
            print question_grids[1].subsection.id
            for group in question_groups.sub_group.all():
                group.subsection = new_subsection<commit_msg>clean up data migration to move hybrids into new subsections<commit_after># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models

class Migration(DataMigration):

    def forwards(self, orm):
        for section in orm.section.objects.filter(title='Immunization Schedule for 2013'):
            subsection = orm.subsection.objects.filter(section=section)
            question_grids = orm.questiongroup.objects.filter(subsection__section=section, hybrid=True, grid=True, parent=None)
            question_groups = question_grids[1]
            next_order = section.sub_sections.count() + 1
            new_subsection = orm.subsection.objects.create(section=section, order=next_order, is_core=subsection[0].is_core, region=subsection[0].region)
            question_groups.subsection = new_subsection
            question_groups.save()
            for group in question_groups.sub_group.all():
                group.subsection = new_subsection
{'fraction_non_alphanumeric': 0.09046927914852443, 'fraction_numerical': 0.010159651669085631, 'mean_word_length': 3.317327766179541, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6350984', 'n_tokens_mistral': 558, 'n_tokens_neox': 561, 'n_words': 122}