from django.contrib.auth.models import AbstractBaseUser
from django.db import models


# Create your models here.
class User(AbstractBaseUser):
    username = models.CharField(max_length=20)
    display_name = models.CharField(max_length=30)
    join_date = models.DateField('date joined')

    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = []

    def get_full_name(self):
        return self.display_name

    def get_short_name(self):
        return self.display_name

    def __str__(self):
        return self.display_name


class Post(models.Model):
    author = models.ForeignKey(User)
    post_text = models.CharField(max_length=500)
    post_time = models.DateTimeField('time posted')

    def __str__(self):
        return self.post_text

@@ -48,16 +48,33 @@
 BaseUser
+, BaseUserManager
 %0Afrom dj
@@ -95,16 +95,32 @@
  models%0A
+import datetime%0A
 %0A%0A# Crea
@@ -146,16 +146,20 @@
 .%0Aclass 
+Temu
 User(Abs
@@ -174,16 +174,74 @@
 eUser):%0A
+    USERNAME_FIELD = 'username'%0A    REQUIRED_FIELDS = %5B%5D%0A%0A
     user
@@ -277,16 +277,29 @@
 ength=20
+, unique=True
 )%0A    di
@@ -351,16 +351,16 @@
     
-join_dat
+is_activ
 e = 
@@ -370,90 +370,136 @@
 els.
-DateField('date joined'
+BooleanField(default=True
 )%0A
-%0A
     
-USERNAME_FIELD = 'username'%0A    REQUIRED_FIELDS = %5B%5D
+is_superuser = models.BooleanField(default=False)%0A    join_date = models.DateField('date joined')
 %0A%0A  
@@ -681,16 +681,685 @@
 _name%0A%0A%0A
+class TemuUserManager(BaseUserManager):%0A    def create_user(self, username, password):%0A        new_user = self.model(%0A            username = username,%0A            join_date = datetime.date.today()%0A        )%0A        new_user.set_password(password)%0A        new_user.save(using=self._db)%0A        return new_user%0A%0A    def create_superuser(self, username, password):%0A        new_superuser = self.model(%0A            username = username,%0A            is_active = True,%0A            is_superuser = True,%0A            join_date = datetime.date.today()%0A        )%0A        new_superuser.set_password(password)%0A        new_superuser.save(using=self._db)%0A        return new_superuser%0A%0A%0A
 class Po
@@ -1407,16 +1407,20 @@
 eignKey(
+Temu
 User)%0A  

Implement UserManager.