account gender and birth date field update fix and add

This commit is contained in:
Parsa Nazer
2025-02-11 22:14:28 +03:30
parent a206ad7079
commit 4234418e51
3 changed files with 24 additions and 6 deletions
+4 -4
View File
@@ -19,18 +19,18 @@ class UserAddressInLine(TabularInline):
@admin.register(User)
class UserAdmin(BaseUserAdmin, ModelAdmin, ImportExportModelAdmin):
# form = UserChangeForm
# add_form = UserCreationForm
form = UserChangeForm
add_form = UserCreationForm
change_password_form = AdminPasswordChangeForm
filter_horizontal = []
ordering = []
inlines = [UserAddressInLine]
list_filter = ['is_superuser']
search_fields = ['phone', 'first_name', 'last_name', 'email']
list_display = ['full_name_display', 'phone', 'email', 'is_superuser', ]
list_display = ['full_name_display', 'phone', 'email', 'is_superuser', 'gender', 'birth_date']
# readonly_fields = ['phone', 'email', 'otp_expiry', 'otp_hash', 'date_joined', 'profile_photo']
exclude = ('otp_hash', 'otp_expiry', 'is_active', 'is_staff', 'password', 'last_login', 'gender', 'birth_date')
exclude = ('otp_hash', 'otp_expiry', 'is_active', 'is_staff', 'password', 'last_login',)
import_form_class = ImportForm
export_form_class = ExportForm
fieldsets = (
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2025-02-11 18:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0008_rename_birth_day_user_birth_date'),
]
operations = [
migrations.AlterField(
model_name='user',
name='gender',
field=models.CharField(choices=[('مرد', 'مرد'), ('زن', 'زن')], max_length=20, verbose_name='جنسیت'),
),
]
+2 -2
View File
@@ -42,8 +42,8 @@ class User(AbstractBaseUser, PermissionsMixin):
is_active = models.BooleanField(default=True, verbose_name='فعال بودن کاربر')
is_staff = models.BooleanField(default=False, verbose_name='کارمند')
gender_option = (
('male', 'مرد'),
('female', 'زن')
('مرد', 'مرد'),
('زن', 'زن')
)
gender = models.CharField(choices=gender_option, max_length=20, verbose_name='جنسیت')
birth_date = models.DateField()