<commit_before>from datetime import datetime
import random

from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save, pre_save
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist

from cc.general.models import VarCharField, EmailField
from cc.geo.models import Location
import cc.ripple.api as ripple
from cc.general.util import cache_on_object
from cc.general.mail import send_mail, email_str

CODE_LENGTH = 20
CODE_CHARS = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

class Profile(models.Model):
    user = models.OneToOneField(User, related_name='profile')
    name = VarCharField(blank=True)
    location = models.ForeignKey(Location, null=True, blank=True)
    photo = models.ImageField(
        upload_to='user/%Y/%m', max_length=256, blank=True)
    description = models.TextField(blank=True)

    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now_add=True)

    trusted_profiles = models.ManyToManyField(
        'Profile', symmetrical=False, related_name='trusting_profiles')

    # TODO: Should a profile always trust itself?

    FEED_TEMPLATE = 'profile_feed_item.html'
    
    def __unicode__(self):
        return self.name or self.username

    @models.permalink
    def get_absolute_url(self):
        return 'profile', (self.username,)

    def set_updated(self):
        """
        Call this every time a user-facing change is made to profile that
        should cause it to be bumped to the top of the feed.
        Must still save the profile after to have any effect.
        """
        self.updated = datetime.now()

    @property
    def username(self):
        # Username is stored in django User model.
        return self.user.username

    @property
    def email(self):
        return self.settings.email
<commit_msg>trusted_profiles blank=True.<commit_after>from datetime import datetime
import random

from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save, pre_save
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist

from cc.general.models import VarCharField, EmailField
from cc.geo.models import Location
import cc.ripple.api as ripple
from cc.general.util import cache_on_object
from cc.general.mail import send_mail, email_str

CODE_LENGTH = 20
CODE_CHARS = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

class Profile(models.Model):
    user = models.OneToOneField(User, related_name='profile')
    name = VarCharField(blank=True)
    location = models.ForeignKey(Location, null=True, blank=True)
    photo = models.ImageField(
        upload_to='user/%Y/%m', max_length=256, blank=True)
    description = models.TextField(blank=True)

    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now_add=True)

    trusted_profiles = models.ManyToManyField(
        'Profile', symmetrical=False, related_name='trusting_profiles',
        blank=True)

    # TODO: Should a profile always trust itself?

    FEED_TEMPLATE = 'profile_feed_item.html'
    
    def __unicode__(self):
        return self.name or self.username

    @models.permalink
    def get_absolute_url(self):
        return 'profile', (self.username,)

    def set_updated(self):
        """
        Call this every time a user-facing change is made to profile that
        should cause it to be bumped to the top of the feed.
        Must still save the profile after to have any effect.
        """
        self.updated = datetime.now()

    @property
    def username(self):
        # Username is stored in django User model.
        return self.user.username

    @property
    def email(self):
        return self.settings.email

{'fraction_non_alphanumeric': 0.07929515418502203, 'fraction_numerical': 0.007774034724021767, 'mean_word_length': 3.639423076923077, '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': '4078402', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1115, 'n_words': 314}