FEATURE(account): convert phone number to english numbers

convert phone number to english numbers
This commit is contained in:
Haydar Ghasemi 2026-05-18 11:37:58 +03:30
parent 3dd62a0173
commit 8859fe4d20
3 changed files with 8 additions and 1 deletions

View file

@ -5,6 +5,7 @@ from rest_framework import serializers
from apps.users.models import User
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from unidecode import unidecode
from utils.exceptions import UnprocessableEntity
@ -62,6 +63,10 @@ class RequestOTPSerializer(serializers.ModelSerializer):
read_only_fields = ['otp_expire', 'ttl']
def validate(self, attrs):
attrs['phone_number'] = unidecode(attrs['phone_number'])
return attrs
def save(self, **kwargs):
# TODO: move it to query set
validated_data = self.validated_data

View file

@ -22,3 +22,4 @@ django_minio_backend
daphne
Twisted[tls,http2]
packaging==25.0
unidecode

View file

@ -246,3 +246,4 @@ zope-interface==8.2
# via
# gevent
# twisted
unidecode==1.4.0