Added
- ComputedField.
- Permission template.
- `reverse_clean` for ForeignKeys.
- Expanded filter methods of querysets (can pass now dict and querysets).
- Properly scoped `with_tenant` and `with_schema`.
Changed
- Managers use now instance attributes (database, schema).
- Expose `as_select` instead of `raw_query`.
- `model_fields` contain now the fields so we can actually use the pydantic magic.
- BREAKING: deprecate `set_tenant` and remove manager hack. This way the tenant scope could leak. Use `with_tenant` instead.
Fixed
- `select_related` works across ManyToMany fields.
- `select_related` couldn't handle multiple pathes to the same table.
- `select_related` would remove valid model instances because of non-existent related objects.
- Fix identifying clashing column names in joins, so every model gets its right parameters.
- Dependency tracking for join, so it doesn't depend on the order of `select_related`.
- `select_related` entries work in any order and don't overwrite each other.
-`only` and `defer` work on `select_related`.
- Autogenerated `id` wasn't added in model_dump.
- Tenants worked only till the first query.
Breaking changes (upgrade path)
python
set_tenant("foo")
Becomes now
python
with with_tenant("foo"):
...
python
activate_schema("foo")
...
deactivate_schema()
Becomes now
python
with with_schema("foo"):
...