account changes

This commit is contained in:
Parsa Nazer
2025-02-11 21:52:03 +03:30
parent 8eaeab9889
commit da111d0148
4 changed files with 22 additions and 4 deletions
+2 -2
View File
@@ -30,11 +30,11 @@ class UserAdmin(BaseUserAdmin, ModelAdmin, ImportExportModelAdmin):
list_display = ['full_name_display', 'phone', 'email', 'is_superuser', ]
# readonly_fields = ['phone', 'email', 'otp_expiry', 'otp_hash', 'date_joined', 'profile_photo']
exclude = ('otp_hash', 'otp_expiry', 'is_active', 'is_staff', 'password', 'last_login')
exclude = ('otp_hash', 'otp_expiry', 'is_active', 'is_staff', 'password', 'last_login', 'gender', 'birth_date')
import_form_class = ImportForm
export_form_class = ExportForm
fieldsets = (
('اطلاعات شخصی', {'fields': ('first_name', 'last_name', 'profile_photo', 'password'),}),
('اطلاعات شخصی', {'fields': ('first_name', 'last_name', 'profile_photo', 'password', 'gender', 'birth_date'),}),
('اطلاعات ارتباطی', {'fields': ('phone', 'email'),}),
)
empty_value_display = 'ثبت نشده'
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2025-02-11 18:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0007_rename_brith_day_user_birth_day'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='birth_day',
new_name='birth_date',
),
]
+1 -1
View File
@@ -46,7 +46,7 @@ class User(AbstractBaseUser, PermissionsMixin):
('female', 'زن')
)
gender = models.CharField(choices=gender_option, max_length=20, verbose_name='جنسیت')
birth_day = models.DateField()
birth_date = models.DateField()
date_joined = models.DateTimeField(auto_now_add=True, verbose_name='تاریخ ثبتنام')
otp_hash = models.CharField(max_length=64, null=True, blank=True, verbose_name='کد یک بار مصرف')
otp_expiry = models.DateTimeField(null=True, blank=True, verbose_name='تاریخ تمام شدن کد یک بار مصرف')
+1 -1
View File
@@ -10,7 +10,7 @@ class CustomTokenObtainPairSerializer(TokenObtainPairSerializer):
class ProfileSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['first_name', 'last_name', 'email', 'profile_photo', 'phone', 'gender', 'birth_day']
fields = ['first_name', 'last_name', 'email', 'profile_photo', 'phone', 'gender', 'birth_date']
read_only_fields = ("phone",)