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

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -