<commit_before># encoding: 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):
        """Give members of the judge group permission to judge all submissions.
        
        Create the group and the permission if necessary.
        
        """
        Group, Permission = orm['auth.Group'], orm['auth.Permission']
        
        ContentType = orm['contenttypes.ContentType']
        submissions = ContentType.objects.get(app_label='challenges',
                                              model='submission')
        
        judge_group, _ = Group.objects.get_or_create(name='Judges')
        judge_perm, _ = Permission.objects.get_or_create(
                                            codename='judge_submission',
                                            name='Can judge submissions',
                                            content_type=submissions)
        # Judges gonna judge
        judge_group.permissions.add(judge_perm)


    def backwards(self, orm):
        "Write your backwards methods here."
        # Don't want to muck up existing data, and the migration is idempotent
        pass


    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),<commit_msg>Fix up the judge group migration.<commit_after># encoding: 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):
        """Give members of the judge group permission to judge all submissions.
        
        Create the group and the permission if necessary.
        
        """
        Group, Permission = orm['auth.Group'], orm['auth.Permission']
        
        ContentType = orm['contenttypes.ContentType']
        try:
            submissions = ContentType.objects.get(app_label='challenges',
                                                  model='submission')
        except ContentType.DoesNotExist:
            submissions = ContentType.objects.create(app_label='challenges',
                                                     model='submission',
                                                     name='submission')
        
        judge_group, _ = Group.objects.get_or_create(name='Judges')
        judge_perm, _ = Permission.objects.get_or_create(
                                            codename='judge_submission',
                                            name='Can judge submissions',
                                            content_type=submissions)
        # Judges gonna judge
        judge_group.permissions.add(judge_perm)


    def backwards(self, orm):
        "Write your backwards methods here."
        # Don't want to muck up existing data, and the migration is idempotent
        pass


    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
{'fraction_non_alphanumeric': 0.09229789942711648, 'fraction_numerical': 0.001273074474856779, 'mean_word_length': 1.7235701906412477, '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': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5824974', 'n_tokens_mistral': 766, 'n_tokens_neox': 725, 'n_words': 199}