mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 06:17:10 +00:00
add created_at to user model
This commit is contained in:
@@ -22,4 +22,4 @@ class LoginSchema(ModelSchema):
|
||||
class UserSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ["id", "email", "username"]
|
||||
fields = ["id", "email", "username", "created_at",]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from datetime import datetime
|
||||
from http import HTTPStatus as status
|
||||
|
||||
from django.contrib.auth.hashers import check_password, make_password
|
||||
@@ -35,6 +36,7 @@ router = Router(tags=["user"])
|
||||
def sign_up(request, data: RegisterSchema):
|
||||
user = User(**data.dict(exclude={"password"}))
|
||||
user.password = make_password(data.password)
|
||||
user.created_at = datetime.now()
|
||||
user.save()
|
||||
|
||||
token = BearerAuth.generate_jwt(user)
|
||||
|
||||
Reference in New Issue
Block a user