<commit_before># encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission


class Migration(DataMigration):

    def forwards(self, orm):
        ct, created = ContentType.objects.get_or_create(model='XForm', app_label='odk_logger')
        # remove old permission label
        Permission.objects.get(codename='can_view').delete()
        # add new permission label
        perm, created = Permission.objects.get_or_create(content_type=ct, codename='view_xform', name='Can view associated data')

    def backwards(self, orm):
        ct, created = ContentType.objects.get_or_create(model='XForm', app_label='odk_logger')
        # remove old permission label
        Permission.objects.get(codename='view_xform').delete()
        # add new permission label
        perm, created = Permission.objects.get_or_create(content_type=ct, codename='can_view', name='Can view associated data')

    models = {<commit_msg>catch exceptions for deleting permissions, update model to use for content type<commit_after># encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission


class Migration(DataMigration):

    def forwards(self, orm):
        # remove old permission label
        try:
            Permission.objects.get(codename='can_view').delete()
        except Permission.DoesNotExist:
            pass
        ct, created = ContentType.objects.get_or_create(model='xform', app_label='odk_logger')
        # add new permission label
        perm, created = Permission.objects.get_or_create(content_type=ct, codename='view_xform', name='Can view associated data')

    def backwards(self, orm):
        # remove old permission label
        try:
            Permission.objects.get(codename='view_xform').delete()
        except Permission.DoesNotExist:
            pass
        ct, created = ContentType.objects.get_or_create(model='xform', app_label='odk_logger')
        # add new permission label
        perm, created = Permission.objects.get_or_create(content_type=ct, codename='can_view', name='Can view associated data')

    models = {
{'fraction_non_alphanumeric': 0.09346186085498742, 'fraction_numerical': 0.0016764459346186086, 'mean_word_length': 3.7931726907630523, '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': '4039973', 'n_tokens_mistral': 666, 'n_tokens_neox': 640, 'n_words': 171}