1👍
✅
i found the answer
from phonenumber_field.modelfields import PhoneNumberField
from phonenumber_field.phonenumber import PhoneNumber
search_fields = ('name', 'address', 'email', 'phone',)
def get_search_results(self, request, queryset, search_term):
queryset, use_distinct = super().get_search_results(request, queryset, search_term)
try:
search_term = PhoneNumber.from_string(search_term, None).as_e164
queryset |= self.model.objects.filter(phone=search_term)
except:
pass
return queryset, use_distinct
Source:stackexchange.com