<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):
        "Write your forwards methods here."
        for project in orm.ProjectRelationship.objects.all():
            project.user = project.contact.user
            project.save()

    def backwards(self, orm):
        "Write your backwards methods here."
        for project in orm.ProjectRelationship.objects.all():
            contact = orm['crm.Contact'].objects.get(user=project.user)
            project.contact = contact
            project.save()

    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),<commit_msg>added a check to delete project relationships without users<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):
        "Write your forwards methods here."
        null_contacts = orm.ProjectRelationship.objects.filter(contact__user__isnull=True)
        null_contacts.delete()
        for project in orm.ProjectRelationship.objects.all():
            project.user = project.contact.user
            project.save()

    def backwards(self, orm):
        "Write your backwards methods here."
        for project in orm.ProjectRelationship.objects.all():
            contact = orm['crm.Contact'].objects.get(user=project.user)
            project.contact = contact
            project.save()

    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
{'fraction_non_alphanumeric': 0.13352826510721247, 'fraction_numerical': 0.003898635477582846, 'mean_word_length': 2.76697247706422, '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': '4643172', 'n_tokens_mistral': 571, 'n_tokens_neox': 560, 'n_words': 142}