Delegate (most) type conversion to backends
|Reported by:||Leo Soto M.||Owned by:||Malcolm Tredinnick|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This patch delegates most of the
get_db_prep_* logic of these fields to backend methods (named
something is date, time, decimal, etc) It also implements
get_db_prep_* for basic field types to avoid leaking string values.
For Jython/zxJDBC compatibility purposes, an special check was made on
'year' lookup. I was not able to understand it, so I choose to introduce as few modifications as possible there. It could be a good idea to delegate that logic to the backend too, but I think a second opinion is needed.
PhoneNumberField doesn't inherits from
IntegerField anymore. There was no point on such inheritance, as phones are mapped to varchar fields on every backend. Not to mention that every method declared by
IntegerField was overriden by
This was tested against mysql, postgresql, oracle and sqlite3, and didn't broke anything (that wasn't already broken on trunk, at least).