I want to do search over Users using their phone number, the search_list
don't do that with fields of PhoneNumberField()
:
class User(AbstractUser, PermissionsMixin):
phone_number = PhoneNumberField( unique=True)
email = models.EmailField("Email address", unique=True, null=True, blank=True)
first_name = models.CharField(_("first name"), max_length=150, blank=True)
last_name = models.CharField(_("last name"), max_length=150, blank=True)
I tried to use this field in the admin:
class UserAdmin(admin.ModelAdmin):
add_form = CustomUserCreationForm
form = UserChangeForm
search_fields = [
"first_name",
"last_name",
"email",
"phone_number",
]
but it didn't work.