Closed omeranson closed 6 years ago
@beregond Could you take a look at this?
I don't think we should add such an implicit coercion, most python code does not define such semantics, and python folks tend to move away it.
You have point @dimakuz but on the other hand there are other examples when what you get is not what you give, like in datetime fields. I think as long as the inner representation is proper (as int
) and we only filter noise that may come from 3rd party sources - we should be ok and this will make life easier for developers (otherwise you would have to write your own field anyway). What do you think, @dimakuz ?
@beregond I agree, if we can cast datetime from string, lets allow this for integers as well
Released in 2.3 - thanks!
Having IntField parse its input allows a field of this type to be assigned by a textual representation of a string or (in python 2) a long.
This allows data sources which mix ints and longs, or ints and their representation, to provide legal values to JSON models.