24 lines
682 B
Python
24 lines
682 B
Python
# -*- encoding: utf-8 -*-
|
|
|
|
import uuid
|
|
|
|
from django.db import models
|
|
from django.contrib.auth.models import AbstractUser
|
|
|
|
|
|
# default user profile image
|
|
# https://st3.depositphotos.com/9998432/13335/v/450/depositphotos_133352156-stock-illustration-default-placeholder-profile-icon.jpg
|
|
|
|
|
|
class User(AbstractUser):
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
icon = models.ImageField(upload_to="users", default="users/default.webp")
|
|
name = models.CharField(max_length=150)
|
|
email = models.EmailField(unique=True)
|
|
|
|
USERNAME_FIELD = "email"
|
|
REQUIRED_FIELDS = ["id", "icon", "name"]
|
|
|
|
def __str__(self):
|
|
return self.name
|