python - Why does Django IntegerField converts unicode to str before converting to int? -



python - Why does Django IntegerField converts unicode to str before converting to int? -

i looked @ django's code integerfield's to_python method. type conversion part

try: value = int(str(value)) except (valueerror, typeerror): raise validationerror(self.error_messages['invalid'], code='invalid')

the code converts value (type unicode) str first , int. why can't cast int straight i.e.

try: value = int(value) except...

python django

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -