<commit_before># Generated by Django 2.2.16 on 2020-10-21 13:46

from django.db import migrations

from adhocracy4.projects.enums import Access


def initialize_access(apps, schema_editor):
    # We can't import the Person model directly as it may be a newer
    # version than this migration expects. We use the historical version.
    Project = apps.get_model('a4projects', 'Project')
    for project in Project.objects.all():
        if project.is_public:
            project.access = Access.PUBLIC
        else:
            project.access = Access.PRIVATE
        project.save()


class Migration(migrations.Migration):

    dependencies = [
        ('a4projects', '0028_project_access'),
    ]

    operations = [
        migrations.RunPython(initialize_access),
    ]<commit_msg>projects/migrations: add backward function to 0029_is_public_to_access<commit_after># Generated by Django 2.2.16 on 2020-10-21 13:46

from django.db import migrations

from adhocracy4.projects.enums import Access


def initialize_access(apps, schema_editor):
    Project = apps.get_model('a4projects', 'Project')
    for project in Project.objects.all():
        if project.is_public:
            project.access = Access.PUBLIC
        else:
            project.access = Access.PRIVATE
        project.save()


def backward_function(apps, schema_editor):
    Project = apps.get_model('a4projects', 'Project')
    for project in Project.objects.all():
        if project.access == Access.PUBLIC:
            project.is_public = True
        else:
            project.is_public = False
        project.save()


class Migration(migrations.Migration):

    dependencies = [
        ('a4projects', '0028_project_access'),
    ]

    operations = [
        migrations.RunPython(initialize_access, backward_function),
    ]
{'fraction_non_alphanumeric': 0.09272626318711827, 'fraction_numerical': 0.028317601332593003, 'mean_word_length': 2.9344978165938866, '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': '4552583', 'n_tokens_mistral': 548, 'n_tokens_neox': 503, 'n_words': 130}