Modify user model, remove unuse function

This commit is contained in:
sosokker 2023-11-23 03:13:19 +07:00
parent a20344c221
commit 3341b3f2a5
3 changed files with 4 additions and 6 deletions

View File

@ -7,7 +7,7 @@ from django.conf import settings
from django.contrib.auth.hashers import make_password
from rest_framework import status
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_simplejwt.tokens import RefreshToken

View File

@ -25,7 +25,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='userstats',
name='luck',
field=models.IntegerField(default=users.models.random_luck, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(50)]),
field=models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(50)]),
),
migrations.AlterField(
model_name='userstats',

View File

@ -31,14 +31,12 @@ class CustomUser(AbstractBaseUser, PermissionsMixin):
# Fields for authentication
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['username', 'first_name']
REQUIRED_FIELDS = []
def __str__(self):
# String representation of the user
return self.username
def random_luck():
return random.randint(1, 50)
class UserStats(models.Model):
"""