<s> from django . contrib . auth . models import AbstractBaseUser , PermissionsMixin <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . core . mail import send_mail <EOL> from django . db import models <EOL> from django . utils import timezone <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from . conf import settings <EOL> from . managers import UserInheritanceManager , UserManager <EOL> class AbstractUser ( AbstractBaseUser , PermissionsMixin ) : <EOL> USERS_AUTO_ACTIVATE = not settings . USERS_VERIFY_EMAIL <EOL> email = models . EmailField ( <EOL> _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , unique = True , db_index = True ) <EOL> is_staff = models . BooleanField ( <EOL> _ ( '<STR_LIT>' ) , default = False , <EOL> help_text = _ ( '<STR_LIT>' ) ) <EOL> is_active = models . BooleanField ( <EOL> _ ( '<STR_LIT>' ) , default = USERS_AUTO_ACTIVATE , <EOL> help_text = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> date_joined = models . DateTimeField ( _ ( '<STR_LIT>' ) , default = timezone . now ) <EOL> user_type = models . ForeignKey ( ContentType , null = True , editable = False ) <EOL> objects = UserInheritanceManager ( ) <EOL> base_objects = UserManager ( ) <EOL> USERNAME_FIELD = '<STR_LIT:email>' <EOL> REQUIRED_FIELDS = [ ] <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> abstract = True <EOL> def get_full_name ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . email <EOL> def get_short_name ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . email <EOL> def email_user ( self , subject , message , from_email = None ) : <EOL> """<STR_LIT>""" <EOL> send_mail ( subject , message , from_email , [ self . email ] ) <EOL> def activate ( self ) : <EOL> self . is_active = True <EOL> self . save ( ) <EOL> def save ( self , * args , ** kwargs ) : <EOL> if not self . user_type_id : <EOL> self . user_type = ContentType . objects . get_for_model ( self , for_concrete_model = False ) <EOL> super ( AbstractUser , self ) . save ( * args , ** kwargs ) <EOL> class User ( AbstractUser ) : <EOL> """<STR_LIT>""" <EOL> class Meta ( AbstractUser . Meta ) : <EOL> swappable = '<STR_LIT>' </s>
