<commit_before># -*- coding: utf-8 -*-
import os

from django.db import migrations


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


def add_item(apps, schema_editor):
    Policy = apps.get_model('app', 'StaticContent')

    content = open(
        os.path.join(BASE_DIR, '../templates/teacher/doc/policy.html')).read()
    content = ''.join(content.split())
    policy, created = Policy.objects.get_or_create(name='policy')
    policy.content = content
    policy.save()

    content_wx = open(
        os.path.join(BASE_DIR,
                     '../templates/teacher/doc/policy_wx.html')).read()
    content_wx = ''.join(content_wx.split())
    policy_wx, created = Policy.objects.get_or_create(name='wxpolicy')
    policy_wx.content = content_wx
    policy_wx.save()

class Migration(migrations.Migration):

    dependencies = [
        ('app', '0159_auto_20160819_1756'),
    ]

    operations = [
        migrations.RunPython(add_item),
    ]<commit_msg>SERVER-252: Policy updated<commit_after># -*- coding: utf-8 -*-
import os

from django.db import migrations


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


def add_item(apps, schema_editor):
    Policy = apps.get_model('app', 'StaticContent')

    content = open(
        os.path.join(BASE_DIR, '../templates/teacher/doc/policy.html')).read()
    content = ''.join(content.split())
    policy, created = Policy.objects.get_or_create(name='policy')
    policy.content = content
    policy.save()

    content_wx = open(
        os.path.join(BASE_DIR,
                     '../templates/teacher/doc/policy_wx.html')).read()
    content_wx = ''.join(content_wx.split())
    policy_wx, created = Policy.objects.get_or_create(name='wxpolicy')
    policy_wx.content = content_wx
    policy_wx.save()

class Migration(migrations.Migration):

    dependencies = [
        ('app', '0160_fix_teacher_schools'),
    ]

    operations = [
        migrations.RunPython(add_item),
    ]
{'fraction_non_alphanumeric': 0.14919354838709678, 'fraction_numerical': 0.012600806451612902, 'mean_word_length': 3.1877637130801686, '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': '3206902', 'n_tokens_mistral': 662, 'n_tokens_neox': 645, 'n_words': 98}