mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 16:47:10 +00:00
add simple user admin and hash password
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.hashers import check_password, make_password
|
||||
|
||||
from apps.core.models import BaseModel
|
||||
|
||||
@@ -11,7 +12,13 @@ class UserRole(models.Choices):
|
||||
class User(BaseModel):
|
||||
email = models.EmailField(unique=True, verbose_name="почта")
|
||||
username = models.SlugField(unique=True, verbose_name="юзернейм")
|
||||
password = models.TextField(verbose_name="пароль")
|
||||
password = models.TextField(verbose_name="пароль", editable=False)
|
||||
|
||||
def make_password(self):
|
||||
return make_password(self.password)
|
||||
|
||||
def check_password(self, password):
|
||||
return check_password(self.password, password)
|
||||
|
||||
status = models.CharField(
|
||||
max_length=10, choices=UserRole, default="student"
|
||||
|
||||
Reference in New Issue
Block a user