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
Post a Comment