ó
A()Qc           @   sï   d  d l  m Z d  d l m Z m Z m Z m Z m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d e f d „  ƒ  YZ
 d	 e f d
 „  ƒ  YZ d e e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   models(   t   BaseUserManagert   AbstractBaseUsert   AbstractUsert   UserManagert   PermissionsMixint   CustomUserManagerc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   sZ   | s t  d ƒ ‚ n  |  j d t j | ƒ d | ƒ } | j | ƒ | j d |  j ƒ | S(   sM   
        Creates and saves a User with the given email and password.
        s    Users must have an email addresst   emailt   date_of_birtht   using(   t
   ValueErrort   modelR   t   normalize_emailt   set_passwordt   savet   _db(   t   selfR   R   t   passwordt   user(    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   create_user   s    		c         C   s;   |  j  | d | d | ƒ} t | _ | j d |  j ƒ | S(   NR   R   R	   (   R   t   Truet   is_adminR   R   (   R   R   R   R   t   u(    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   create_superuser    s    	N(   t   __name__t
   __module__t   NoneR   R   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR      s   t
   CustomUserc           B   sä   e  Z e j d  d d d d e ƒ Z e j d e ƒ Z e j d e ƒ Z	 e j
 ƒ  Z e ƒ  Z d Z d g Z d d d	 „  ƒ  YZ d
 „  Z d „  Z d „  Z d d „ Z d d „ Z d d „ Z d d „ Z d „  Z e d „  ƒ Z RS(   t   verbose_names   email addresst
   max_lengthiÿ   t   uniquet   defaultR   R   t   Metac           B   s   e  Z d  Z RS(   t   auth(   R   R   t	   app_label(    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR    2   s   c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   get_full_name5   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   get_short_name8   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   __unicode__;   s    c         C   s   t  ƒ  S(   N(   t   set(   R   t   obj(    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   get_group_permissions?   s    c         C   s   t  ƒ  S(   N(   R&   (   R   R'   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   get_all_permissionsB   s    c         C   s   t  S(   N(   R   (   R   t   permR'   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   has_permE   s    c         C   s   t  S(   N(   R   (   R   t	   perm_listR'   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt	   has_permsH   s    c         C   s   t  S(   N(   R   (   R   R"   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   has_module_permsK   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   is_staffO   s    (    N(   R   R   R    t
   EmailFieldR   R   t   BooleanFieldt	   is_activet   FalseR   t	   DateFieldR   R   t   custom_objectst   USERNAME_FIELDt   REQUIRED_FIELDSR    R#   R$   R%   R   R(   R)   R+   R-   R.   t   propertyR/   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR   '   s"   						t   ExtensionUserc           B   s@   e  Z e j ƒ  Z e ƒ  Z e j d  g Z d d d „  ƒ  YZ	 RS(   R   R    c           B   s   e  Z d  Z RS(   R!   (   R   R   R"   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR    _   s   (    (
   R   R   R    R4   R   R   R5   R   R7   R    (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR9   X   s   	t   CustomPermissionsUserManagerc           B   s   e  Z d  „  Z RS(   c         C   s;   |  j  | d | d | ƒ} t | _ | j d |  j ƒ | S(   NR   R   R	   (   R   R   t   is_superuserR   R   (   R   R   R   R   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR   h   s    	(   R   R   R   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR:   g   s   t   CustomPermissionsUserc           B   sx   e  Z e j d  d d d d e ƒ Z e j ƒ  Z e ƒ  Z	 d Z
 d g Z d d d „  ƒ  YZ d	 „  Z d
 „  Z d „  Z RS(   R   s   email addressR   iÿ   R   R   R   R    c           B   s   e  Z d  Z RS(   R!   (   R   R   R"   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR    x   s   c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR#   {   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR$   ~   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR%      s    (    (   R   R   R    R0   R   R   R4   R   R:   R5   R6   R7   R    R#   R$   R%   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR<   o   s   				t   IsActiveTestUser1c           B   sH   e  Z d  Z e j d d d e ƒ Z e ƒ  Z d Z	 d d d „  ƒ  YZ
 RS(   sR   
    This test user class and derivatives test the default is_active behavior
    R   i   R   t   usernameR    c           B   s   e  Z d  Z RS(   R!   (   R   R   R"   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR       s   (    (   R   R   t   __doc__R    t	   CharFieldR   R>   R   R5   R6   R    (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR=   …   s
   	t   CustomUserNonUniqueUsernamec           B   s9   e  Z d  Z e j d d ƒ Z d Z d d d „  ƒ  YZ RS(   s!   A user with a non-unique usernameR   i   R>   R    c           B   s   e  Z d  Z RS(   R!   (   R   R   R"   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR    ›   s   (    (   R   R   R?   R    R@   R>   R6   R    (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyRA   •   s   t   CustomUserBadRequiredFieldsc           B   sW   e  Z d  Z e j d d d e ƒ Z e j ƒ  Z d Z	 d d g Z
 d d d „  ƒ  YZ RS(	   s!   A user with a non-unique usernameR   i   R   R>   R   R    c           B   s   e  Z d  Z RS(   R!   (   R   R   R"   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyR    §   s   (    (   R   R   R?   R    R@   R   R>   R4   R   R6   R7   R    (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyRB   Ÿ   s   N(   t	   django.dbR    t   django.contrib.auth.modelsR   R   R   R   R   R   R   R9   R:   R<   R=   RA   RB   (    (    (    s>   ../Django//lib/python/django/contrib/auth/tests/custom_user.pyt   <module>   s   (1
