Releases: dymmond/edgy
Releases · dymmond/edgy
Version 0.27.0
Changed
- Added a new table naming schema for through models of ManyToMany fields. This requires however setting
an explicit table naming schema via thethrough_tablename
parameter. - When
through_tablename
is a string, it is formatted with the field injected as field in the context.
Fixed
- Multiple ManyFields from the same model to the same target model. Note: this is unrelated to
related_name
, setting the
therelated_name
would not help.
BREAKING
For now ManyToMany fields must explicitly have a through_tablename
parameter in which
the table naming schema for the through model is selected.
For existing ManyToMany fields you should pass edgy.OLD_M2M_NAMING"
so migrations doesn't drop the tables,
for new ManyToMany fields edgy.NEW_M2M_NAMING"
which prevents clashes of through model names.
You may can also rename the through model table via migration and use the edgy.NEW_M2M_NAMING"
or simply use a non-empty string for the through_tablename
parameter.
Version 0.26.1
Added
- Add PGArrayField.
- Add
build_and_save(...)
build variant to ModelFactory. - Add
build(save=True)
to ModelFactory.
Changed
- Reorganize fields. Make more lazy.
- Make models, querysets imports in
__init__.py
lazy so circular dependency errors arise no more. - Change in ModelFactory the default of
exclude_autoincrement
fromFalse
toTrue
.
There is a strong demand in having save ready models.
Version 0.26.0
Added
__drop_extra_kwargs__
parameter for Models which drops extra kwargs instead passing down. Required for mashalling StrictModel.reference_select
parameter in QuerySet.extra_select
parameter in QuerySet for creating extra select clauses which can be referenced.ref_foreign_key_fields
in meta.
Changed
- Model allows now like ReflectModel arbitary arguments. Required for
reference_select
. - Use a partly copied model as ProxyModel. This ensures that the logic of ReflectField still works.
Fixed
- Cleanup of event-loops and threads in run_sync.
- Fix running shell with auto reflected models.
- Fix
DatabaseNotConnectedWarning
in shell. - Usage of StrictModels in Mashalls.
- Different autoincrement field in Marshalls than
id
. - Fix Marshall required check.
- Fix ReflectModel with exclude_secrets.
- Fix non-edgy-fields were stripped instead kept.
- Allow ComputedFields being part of a serialization.
Version 0.25.1
Added
- Add
exclude_autoincrement
parameter/class attribute to ModelFactory. - Add
build_values
method to ModelFactory. It can be used to extract the values without a model. - Make Registry initialization compatible with sync contexts via
with_async_env(loop=None)
method. run_sync
has now an optional loop parameter.
Changed
- The Relation mappings doesn't set the autoincrement id anymore.
- Relationship fields of auto generated ModelFactories of ForeignKey, ... are now excluded when not parametrized.
This way large trees are avoided. - Reduce the amount of generated related models to max 10 by default.
- Make
to_factory_field
andto_list_factory_field
a method instead a classmethod.
Otherwise they are quite limited. to_list_factory_field
honors the min and max parameter specified by parameters.
It defaults however to the provided min and max parameters.- RefForeignKey has now an extra subclass of BaseField. This way the exclusion of works reliable.
run_sync
reuses idling loops.run_sync
uses the loop set by the Registry contextmanagerwith_async_env
.
Fixed
- ModelFactory was prone to run in infinite recursions.
- The RefForeignKey field was not working correctly.
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.