Delegate (most) type conversion to backends
|Reported by:||leosoto||Owned by:||mtredinnick|
|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 value_to_db_something where 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 Field.get_db_prep_lookup and '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.
Finally, 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 PhoneNumberField.
This was tested against mysql, postgresql, oracle and sqlite3, and didn't broke anything (that wasn't already broken on trunk, at least).
Change History (18)
Changed 8 years ago by adamv
comment:1 Changed 8 years ago by anonymous
- milestone set to 1.0 beta
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
Changed 8 years ago by seanl
comment:9 Changed 8 years ago by mtredinnick
- Resolution set to fixed
- Status changed from new to closed