New features
- Postgres
BinaryJSONFieldnow supportshas_key(),concat()andremove()methods (though remove may require pg10+). - Add
python_value()method to the SQL-function helperfn, to allow specifying a custom function for mapping database values to Python values.
Changes
- Better support for UPDATE ... FROM queries, and more generally, more robust support for UPDATE and RETURNING clauses. This means that the
QualifiedNameshelper is no longer needed for certain types of queries. - The
SqlCipherDatabaseno longer accepts akdf_iterparameter. To configure the various SQLCipher encryption settings, specify the setting values aspragmaswhen initializing the database. - Introspection will now, by default, only strip "_id" from introspected column names if those columns are foreign-keys. See #1799 for discussion.
- Allow
UUIDFieldandBinaryUUIDFieldto accept hexadecimal UUID strings as well as raw binary UUID bytestrings (in addition toUUIDinstances, which are already supported). - Allow
ForeignKeyFieldto be created without an index. - Allow multiple calls to
cast()to be chained (#1795). - Add logic to ensure foreign-key constraint names that exceed 64 characters are truncated using the same logic as is currently in place for long indexes.
ManyToManyFieldsupports foreign-keys to fields other than primary-keys.- When linked against SQLite 3.26 or newer, support
SQLITE_CONSTRAINTto designate invalid queries against virtual tables. - SQL-generation changes to aid in supporting using queries within expressions following the SELECT statement.
Bugfixes
- Fixed bug in
order_by_extend(), thanks @nhatHero. - Fixed bug where the
DataSetCSV import/export did not support non-ASCII characters in Python 3.x. - Fixed bug where
model_to_dictwould attempt to traverse explicitly disabled foreign-key backrefs (#1785). - Fixed bug when attempting to migrate SQLite tables that have a field whose column-name begins with "primary_".
- Fixed bug with inheriting deferred foreign-keys.