<commit_before>from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db.models import TextField, ForeignKey, DateTimeField, OneToOneField, ManyToManyField, EmailField, \
    BooleanField
from django.utils import timezone
from yunity.models.abstract import MapItem, Conversation, Request
from yunity.models.utils import BaseModel, MaxLengthCharField


class UserManager(BaseUserManager):
    use_in_migrations = True

    def _create_user(self, email, password, locations, type, display_name, **extra_fields):
        """ Creates and saves a User with the given username, email and password.

        """
        now = timezone.now()
        if email is None:
            raise ValueError('The given email must be set')
        email = self.normalize_email(email)
        if locations is None:
            locations = {'latitude': 0.0, 'longitude': 0.0}
        if type is None:
            type = Category.objects.get(name="user.default")
        if display_name is None:
            display_name = email

        user = self.model(email=email, is_active=True, date_joined=now, locations=locations, type=type,
                          display_name=display_name, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_user(self, email=None, password=None, locations=None, type=None, display_name=None, **extra_fields):
        return self._create_user(email, password, locations, type, display_name, **extra_fields)

    def create_superuser(self, email, password, **extra_fields):
        return self._create_user(email, password, None, None, None, **extra_fields)


class User(AbstractBaseUser, MapItem):
    email = EmailField(max_length=64, unique=True)
    is_active = BooleanField(default=True)
    is_staff = BooleanField(default=False)
    date_joined = DateTimeField(default=timezone.now)
    display_name = TextField()

    objects = UserManager()

    USERNAME_FIELD = 'email'

    def to_es(self):
        return super().to_es()

    def get_full_name(self):
        return self.name

    def get_short_name(self):
        return self.name


class Valuable(MapItem):
    def to_es(self):
        return super().to_es()


class Opportunity(MapItem):<commit_msg>Added picture_url to User model<commit_after>from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db.models import TextField, ForeignKey, DateTimeField, OneToOneField, ManyToManyField, EmailField, \
    BooleanField
from django.utils import timezone
from yunity.models.abstract import MapItem, Conversation, Request
from yunity.models.utils import BaseModel, MaxLengthCharField


class UserManager(BaseUserManager):
    use_in_migrations = True

    def _create_user(self, email, password, locations, type, display_name, **extra_fields):
        """ Creates and saves a User with the given username, email and password.

        """
        now = timezone.now()
        if email is None:
            raise ValueError('The given email must be set')
        email = self.normalize_email(email)
        if locations is None:
            locations = {'latitude': 0.0, 'longitude': 0.0}
        if type is None:
            type = Category.objects.get(name="user.default")
        if display_name is None:
            display_name = email

        user = self.model(email=email, is_active=True, date_joined=now, locations=locations, type=type,
                          display_name=display_name, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_user(self, email=None, password=None, locations=None, type=None, display_name=None, **extra_fields):
        return self._create_user(email, password, locations, type, display_name, **extra_fields)

    def create_superuser(self, email, password, **extra_fields):
        return self._create_user(email, password, None, None, None, **extra_fields)


class User(AbstractBaseUser, MapItem):
    email = EmailField(max_length=64, unique=True)
    is_active = BooleanField(default=True)
    is_staff = BooleanField(default=False)
    date_joined = DateTimeField(default=timezone.now)
    display_name = TextField()
    picture_url = TextField(null=True)

    objects = UserManager()

    USERNAME_FIELD = 'email'

    def to_es(self):
        return super().to_es()

    def get_full_name(self):
        return self.name

    def get_short_name(self):
        return self.name


class Valuable(MapItem):
    def to_es(self):
        return super().to_es()


class Opportunity(MapItem):
{'fraction_non_alphanumeric': 0.09527953012834457, 'fraction_numerical': 0.0026103980857080703, 'mean_word_length': 3.4296724470134876, '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': '88910', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1299, 'n_words': 339}