27 lines
768 B
Python
27 lines
768 B
Python
![]() |
from django.contrib.auth.base_user import AbstractBaseUser
|
||
|
from django.db import models
|
||
|
|
||
|
|
||
|
class User(AbstractBaseUser):
|
||
|
first_name = models.CharField(max_length=100)
|
||
|
last_name = models.CharField(max_length=100)
|
||
|
|
||
|
email = models.EmailField(db_index=True, unique=True, max_length=50)
|
||
|
is_active = models.BooleanField(default=False)
|
||
|
|
||
|
confirmation_number = models.CharField(max_length=100)
|
||
|
reset_code = models.CharField(max_length=100)
|
||
|
avatar = models.ImageField(upload_to="avatars/", null=True)
|
||
|
|
||
|
USERNAME_FIELD = "email"
|
||
|
|
||
|
class Meta:
|
||
|
ordering = ("id", )
|
||
|
|
||
|
def get_details(self):
|
||
|
return {
|
||
|
"first_name": self.first_name,
|
||
|
"last_name": self.last_name,
|
||
|
"email": self.email
|
||
|
}
|