from django.db import models

from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.conf import settings


class UserProfileManager(BaseUserManager):
    def create_user(self, email, name, avatar, password=None):
        if not email:
            raise ValueError("user must have an email address")
        email = self.normalize_email(email)
        user = self.model(email=email, name=name, avatar=avatar)

        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, email, name, avatar, password):
        user = self.create_user(email, name, avatar, password)

        user.is_superuser = True
        user.is_staff = True
        user.save(using=self._db)

        return user


class UserProfile(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField(max_length=255, unique=True)
    name = models.CharField(max_length=255)
    avatar = models.IntegerField(default=1)

    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=False)

    objects = UserProfileManager()

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['name']

    def __str__(self):
        return self.name


class Answer(models.Model):

    question       = models.CharField(max_length=500, default='')
    user_answer    = models.CharField(max_length=500, default='')

    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.question + ' - ' + self.user_answer


cf188abeadde519af74b0726ba034577035b5887
<mask token>


class Answer(models.Model):
    question = models.CharField(max_length=500, default='')
    user_answer = models.CharField(max_length=500, default='')
    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.question + ' - ' + self.user_answer

<mask token>


class UserProfile(AbstractBaseUser, PermissionsMixin):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def __str__(self):
        return self.name


class Answer(models.Model):
    question = models.CharField(max_length=500, default='')
    user_answer = models.CharField(max_length=500, default='')
    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.question + ' - ' + self.user_answer

<mask token>


class UserProfileManager(BaseUserManager):

    def create_user(self, email, name, avatar, password=None):
        if not email:
            raise ValueError('user must have an email address')
        email = self.normalize_email(email)
        user = self.model(email=email, name=name, avatar=avatar)
        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, email, name, avatar, password):
        user = self.create_user(email, name, avatar, password)
        user.is_superuser = True
        user.is_staff = True
        user.save(using=self._db)
        return user


class UserProfile(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField(max_length=255, unique=True)
    name = models.CharField(max_length=255)
    avatar = models.IntegerField(default=1)
    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=False)
    objects = UserProfileManager()
    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['name']

    def __str__(self):
        return self.name


class Answer(models.Model):
    question = models.CharField(max_length=500, default='')
    user_answer = models.CharField(max_length=500, default='')
    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.question + ' - ' + self.user_answer

from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.conf import settings


class UserProfileManager(BaseUserManager):

    def create_user(self, email, name, avatar, password=None):
        if not email:
            raise ValueError('user must have an email address')
        email = self.normalize_email(email)
        user = self.model(email=email, name=name, avatar=avatar)
        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, email, name, avatar, password):
        user = self.create_user(email, name, avatar, password)
        user.is_superuser = True
        user.is_staff = True
        user.save(using=self._db)
        return user


class UserProfile(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField(max_length=255, unique=True)
    name = models.CharField(max_length=255)
    avatar = models.IntegerField(default=1)
    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=False)
    objects = UserProfileManager()
    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['name']

    def __str__(self):
        return self.name


class Answer(models.Model):
    question = models.CharField(max_length=500, default='')
    user_answer = models.CharField(max_length=500, default='')
    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.question + ' - ' + self.user_answer

from django.db import models

from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.conf import settings


class UserProfileManager(BaseUserManager):
    def create_user(self, email, name, avatar, password=None):
        if not email:
            raise ValueError("user must have an email address")
        email = self.normalize_email(email)
        user = self.model(email=email, name=name, avatar=avatar)

        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, email, name, avatar, password):
        user = self.create_user(email, name, avatar, password)

        user.is_superuser = True
        user.is_staff = True
        user.save(using=self._db)

        return user


class UserProfile(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField(max_length=255, unique=True)
    name = models.CharField(max_length=255)
    avatar = models.IntegerField(default=1)

    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=False)

    objects = UserProfileManager()

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['name']

    def __str__(self):
        return self.name


class Answer(models.Model):

    question       = models.CharField(max_length=500, default='')
    user_answer    = models.CharField(max_length=500, default='')

    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.question + ' - ' + self.user_answer

