<commit_before>"""
WE'RE USING MIGRATIONS!

If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,

1. Go to the mitx dir
2. django-admin.py schemamigration student --auto --settings=lms.envs.dev --pythonpath=. description_of_your_change
3. Add the migration file created in mitx/common/djangoapps/external_auth/migrations/
"""

from django.db import models
from django.contrib.auth.models import User

class ExternalAuthMap(models.Model):
    external_id = models.CharField(max_length=255, db_index=True, unique=True)
    external_domain = models.CharField(max_length=255, db_index=True)
    external_credentials = models.TextField(blank=True)  # JSON dictionary 
    external_email = models.CharField(max_length=255, db_index=True)
    external_name = models.CharField(blank=True,max_length=255, db_index=True)
    user = models.OneToOneField(User, unique=True, db_index=True, null=True)
    internal_password = models.CharField(blank=True, max_length=31)	# randomly generated
    dtcreated = models.DateTimeField('creation date',auto_now_add=True)
    dtsignup = models.DateTimeField('signup date',null=True)		# set after signup
    
    def __unicode__(self):
        s = "[%s] = (%s / %s)" % (self.external_id, self.external_name, self.external_email)
        return s
    <commit_msg>change model to have external_id and external_domain be unique_together<commit_after>"""
WE'RE USING MIGRATIONS!

If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,

1. Go to the mitx dir
2. django-admin.py schemamigration student --auto --settings=lms.envs.dev --pythonpath=. description_of_your_change
3. Add the migration file created in mitx/common/djangoapps/external_auth/migrations/
"""

from django.db import models
from django.contrib.auth.models import User

class ExternalAuthMap(models.Model):
    class Meta:
        unique_together = (('external_id', 'external_domain'), )
    external_id = models.CharField(max_length=255, db_index=True)
    external_domain = models.CharField(max_length=255, db_index=True)
    external_credentials = models.TextField(blank=True)  # JSON dictionary 
    external_email = models.CharField(max_length=255, db_index=True)
    external_name = models.CharField(blank=True,max_length=255, db_index=True)
    user = models.OneToOneField(User, unique=True, db_index=True, null=True)
    internal_password = models.CharField(blank=True, max_length=31)	# randomly generated
    dtcreated = models.DateTimeField('creation date',auto_now_add=True)
    dtsignup = models.DateTimeField('signup date',null=True)		# set after signup
    
    def __unicode__(self):
        s = "[%s] = (%s / %s)" % (self.external_id, self.external_name, self.external_email)
        return s
    
{'fraction_non_alphanumeric': 0.09937888198757763, 'fraction_numerical': 0.011732229123533472, 'mean_word_length': 4.717948717948718, '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': '1356162', 'n_tokens_mistral': 922, 'n_tokens_neox': 889, 'n_words': 238}