From 48f837b5a540e5a3982baadca9ea434b5112c373 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Wed, 29 Oct 2025 17:09:55 +0330 Subject: [PATCH] fix - overwrite useranme field in User from AbstractUser --- apps/authentication/models.py | 7 +++++++ logs/django_requests.log | 3 +++ 2 files changed, 10 insertions(+) diff --git a/apps/authentication/models.py b/apps/authentication/models.py index 4db2a1e..a9ddd65 100644 --- a/apps/authentication/models.py +++ b/apps/authentication/models.py @@ -2,11 +2,18 @@ from django.contrib.auth.models import ( AbstractUser ) from django.db import models +from django.utils.translation import gettext_lazy as _ from apps.core.models import BaseModel class User(AbstractUser, BaseModel): + username = models.CharField( + max_length=150, + help_text=_( + "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." + ), + ) mobile = models.CharField(max_length=18, null=True) phone = models.CharField(max_length=18, null=True) national_code = models.CharField(max_length=16, null=True) diff --git a/logs/django_requests.log b/logs/django_requests.log index ae11cdb..2af26a2 100644 --- a/logs/django_requests.log +++ b/logs/django_requests.log @@ -584,3 +584,6 @@ AssertionError: .validate() should return the validated data [2025-10-29 16:57:50,609] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading. [2025-10-29 16:57:52,543] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader [2025-10-29 16:57:57,860] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading. +[2025-10-29 16:58:00,956] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-10-29 17:09:28,263] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\models.py changed, reloading. +[2025-10-29 17:09:30,370] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader