Releases: dymmond/edgy
Releases · dymmond/edgy
Version 0.25.0
Added
- Add
testing.factory.ModelFactory
. - ManyToManyField
create_through_model
method allows now the keyword only argumentreplace_related_field
. add_to_registry
and models have now an additional keyword-only argumenton_conflict
for controlling what happens when a same named model already exists.
For models this can be passed :class Foo(edgy.Model, on_conflict="keep"): ...
.- Passing a tuple or list of types to
replace_related_field
is now allowed. - Add
through_registry
to ManyToMany. - Add
no_copy
to models MetaInfo. - Add
ModelCollisionError
exception. - Add keyword only hook function
real_add_to_registry
. It can be used to customize theadd_to_registry
behaviour. - Add
__no_load_trigger_attrs__
to edgy base model to prevent some attrs from causing a deferred load.
Changed
create_edgy_model
has now__type_kwargs__
which contains a dict of keyword arguments provided to__new__
of type.- RelatedField uses now
no_copy
. add_to_registry
returns the type which was actually added to registry instead of None.- Through models use now
no_copy
when autogenerated. This way they don't land in copied registries but are autogenerated again. - Instead of silent replacing models with the same
__name__
now an error is raised. skip_registry
has now also an allowed literal value:"allow_search"
. It enables the search of the registry but doesn't register the model.- Move
testclient
totesting
but keep a forward reference. - Change the default for ManyToMany
embed_through
from "" toFalse
which affected traversing ManyToMany. - Better protect secrets from leaking. Prevent load when accessing a secret field or column.
Fixed
- Copying registries and models is working now.
- Fix deleting (clearing cache) of BaseForeignKey target.
- Creating two models with the same name did lead to silent replacements.
- Invalidating caused schema errors.
- ManyToMany and ForeignKey fields didn't worked when referencing tenant models.
- ManyToMany fields didn't worked when specified on tenant models.
- Fix transaction method to work on instance and class.
- Fix missing file conversion in File. Move from ContentFile.
- Fix mypy crashing after the cache was build (cause ChoiceField annotation).
- Fix handling unknown fields via the generic_field.
- Sanify default for embed_through which affected traversing ManyToMany.
It defaulted to the backward compatible "" which requires the user to traverse the m2m model first. - Prevent fully initialized models from triggering a deferred load.
- Prevent accessing excluded secrets from triggering a deferred load.
BREAKING
- Instead of silent replacing models with the same
__name__
now an error is raised. - The return value of
add_to_registry
changed. If you customize the function you need to return now the actual model added to the registry. - The default for ManyToMany
embed_through
changed from "" toFalse
which affected traversing ManyToMany. For keeping the old behaviour pass:
embed_through=""
. - Accessing field values excluded by exclude_secrets doesn't trigger an implicit load anymore.
Version 0.24.2
Fixed
- Try harder to avoid circular imports when providing settings with edgy references.
Version 0.24.1
Fixed
- Comparation of a model with non-models.
Version 0.24.0
Added
- True multi-database migrations.
You may need to rework your migrations in case you want to use it. - Generalized
hash_to_identifier
function. get_name
function onmetadata_by_url
dict.- Differing databases can be passed via
database
attribute on models. create
method on relations (reverse side of ForeignKeys and both sides of ManyToMany).
Changed
- Breaking: empty names are not allowed anymore for extra. This includes names consisting of spaces.
Fixed
- ForeignKey remote check failed for objects with different database but same registry.
Version 0.23.3
Fixed
- Version number mismatch.
Version 0.23.1 & 0.23.2
Fixed
- Docs were broken.
- Autodetection of the instance was broken when a directory containing dots is in the folder.
- Fix compatibility with pydantic 2.10.
Note: there is a version number mismatch.
Version 0.23.0
Added
- Extension support via Monkay.
Changed
- Rework edgy to use Monkay.
- Imports are now lazy.
- Rework the migrate and shell system to simply use Monkay instance.
- Replace
get_registry_copy
byget_migration_prepared_registry
. - Breaking: migration configuration takes place in settings.
- Breaking: EdgyExtra and Migrate are replaced by
edgy.Instance
but are still available. - Breaking: EdgyExtra is provided by the also obsolete Migrate.
- Breaking:
model_apps
is replaced bypreloads
but still available during the migration time. - Breaking:
An automatic registration is assumed. See Connection for examples. - Breaking:
--app
orEDGY_DEFAULT_APP
must point to a module which does the self-registration not an app instance anymore. - Deprecate
edgy.conf.enums.EnvironmentType
. EsmeraldsEnvironmentType
or an own definition should be used instead. - Deprecate
edgy.conf.module_import.import_string
. Usemonkay.load
instead.
Fixed
- Migrations with ManyToMany fields are broken.
get_engine_url_and_metadata
was broken for some operations (thanks @Kokoserver).- IPAddressField was not exposed as edgy.IPAddressField.
Removed
edgy.conf.functional
. It was only used for configuration and is now superseeded by Monkay.
Contributors
Thanks a lot to @Kokoserver. He provided a lot of valuable bug reports and PRs.
Version 0.22.0
0.22.0
Added
- Global constraints via meta.
- Allow functional indexes.
- Expose further parameters for UniqueConstraints.
no_copy
attribute for fields.
Changes
- Breaking: Factories pass now the kwargs as dict to get_pydantic_type, get_column_type, get_constraints.
This allows now modifying the arguments passed down to the field. - Breaking: init_fields_mapping doesn't initializes the field stats anymore.
- Breaking: model rebuilds are executed lazily when calling init_fields_mapping not when assigning fields manually anymore.
Fixed
- Indexes and unique_together worked only for fields with columns of the same name.
- MigrateConfig has no get_registry_copy.
- Migrations have duplicate fks and crash.
- ContentTypes were not copyable.
- VirtualCascade was not automatically enabled.
- Improve lazyness by splitting in two variable sets.
Version 0.21.2
Added
- PlaceholderField.
- StrictModel which forbids extra attributes.
Changed
- Validate on assignment is enabled.
- IPAddressField uses now pydantic validation and a simplified TypeDecorator.
- URLField is now validated.
Fixed
- Pydantic validators are fixed. Field based ones as well as model based ones.
__dict__
was wiped out when intializing a model.
Version 0.21.1
Changed
- Breaking: from_kwargs doesn't require model or table anymore. It is simply ignored.
Fixed
- Q, and_, or_ support now complex kwargs like querysets.
- Failure querying when using proxy model table and kwargs.
- Proxy and main model use now the same tables.
This could have been a problem when filtering against table columns of the proxy table in a query from the main table. - Queries operate now always on the main model not the proxy model.
- Stacklevel of performance warning was wrong.