Skip to content

Releases: dymmond/edgy

Version 0.27.0

03 Feb 09:17
56cecd4
Compare
Choose a tag to compare

Changed

  • Added a new table naming schema for through models of ManyToMany fields. This requires however setting
    an explicit table naming schema via the through_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
    the related_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

02 Feb 08:48
30a0a2a
Compare
Choose a tag to compare

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 from False to True.
    There is a strong demand in having save ready models.

Version 0.26.0

28 Jan 14:51
0.26.0
54d7240
Compare
Choose a tag to compare

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

23 Jan 11:42
0.25.1
50f4fdb
Compare
Choose a tag to compare

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 and to_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 contextmanager with_async_env.

Fixed

  • ModelFactory was prone to run in infinite recursions.
  • The RefForeignKey field was not working correctly.

Version 0.25.0

21 Jan 20:35
0.25.0
ea6a5b8
Compare
Choose a tag to compare

Added

  • Add testing.factory.ModelFactory.
  • ManyToManyField create_through_model method allows now the keyword only argument replace_related_field.
  • add_to_registry and models have now an additional keyword-only argument on_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 the add_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 to testing but keep a forward reference.
  • Change the default for ManyToMany embed_through from "" to False 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 "" to False 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

07 Jan 16:24
0.24.2
080031a
Compare
Choose a tag to compare

Fixed

  • Try harder to avoid circular imports when providing settings with edgy references.

Version 0.24.1

19 Dec 09:07
0.24.1
6dbecfd
Compare
Choose a tag to compare

Fixed

  • Comparation of a model with non-models.

Version 0.24.0

16 Dec 12:19
0.24.0
71f52f8
Compare
Choose a tag to compare

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 on metadata_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

22 Nov 18:21
0.23.3
b379360
Compare
Choose a tag to compare

Fixed

  • Version number mismatch.

Version 0.23.1 & 0.23.2

22 Nov 14:10
0.23.2
a26a34d
Compare
Choose a tag to compare

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.