Skip to content

Releases: collerek/ormar

Fix saving string pks

20 Nov 12:12
Compare
Choose a tag to compare
Fix saving string pks Pre-release
Pre-release

Fix issue #46 , also added refresh after save() if any field has server_default set and field not set (so it will be populated by server default

Add upsert, save_related, allow dict in fields and exclude_fields, optimisation and cleanup etc.

16 Nov 12:33
a77fb01
Compare
Choose a tag to compare
  • Added save status -> you can check if model is saved with ModelInstance.saved property
    • Model is saved after save/update/load/upsert method on model
    • Model is saved after create/get/first/all/get_or_create/update_or_create method
    • Model is saved when passed to bulk_update and bulk_create
    • Model is saved after adding/removing ManyToMany related objects (through model instance auto saved/deleted)
    • Model is not saved after change of any own field (including pk as Model.pk alias)
    • Model is not saved after adding/removing ForeignKey related object (fk column not saved)
    • Model is not saved after instantation with __init__ (w/o QuerySet.create or before calling save)
  • Added Model.upsert(**kwargs) that performs save() if pk not set otherwise update(**kwargs)
  • Added Model.save_related(follow=False) that iterates all related objects in all relations and checks if they are saved. If not it calls upsert() on each of them.
  • Breaking: added raising exceptions if add-ing/remove-ing not saved (pk is None) models to ManyToMany relation
  • Allow passing dictionaries and sets to fields and exclude_fields
  • Auto translate str and lists to dicts for fields and exclude_fields
  • Breaking: passing nested models to fields and exclude_fields is now by related ForeignKey name and not by target model name
  • Performance optimizations - in modelproxy, newbasemodel - > less queries, some properties are cached on models
  • Cleanup of unused relations code
  • Optional performance dependency orjson added (strongly recommended)
  • Updated docs

Add exclude_fields, fix order_by

11 Nov 09:53
5552a82
Compare
Choose a tag to compare
Pre-release
  • add exclude_fields() method to exclude fields from sql
  • refactor column names setting (aliases)
  • fix ordering by for column with aliases
  • additional tests for fields and exclude_fields
  • update docs

Include property methods as fields in dict() and json()

10 Nov 10:40
9413e51
Compare
Choose a tag to compare
Merge pull request #34 from collerek/include_properties_in_dict_and_json

Include properties in dict and json

Allow returning related models with only pk set through fastapi

09 Nov 15:15
7a1dbfa
Compare
Choose a tag to compare
Merge pull request #32 from collerek/allow_pk_models_fastapi

allow in fastapi to return related models with only pk populated

Add order_by to QuerySet

09 Nov 13:24
944bb83
Compare
Choose a tag to compare
Pre-release

Add order_by to QuerySet
Update docs

Provide support for proper type hints - change of model definition (non breaking)

01 Nov 12:25
Compare
Choose a tag to compare
  • Changed notation in Model definition -> now use name = ormar.Field() not name: ormar.Field()
  • Note that old notation is still supported but deprecated and will not play nice with static checkers like mypy and pydantic pycharm plugin
  • Type hint docs and test
  • Use mypy for tests also not, only ormar package
  • Fix scale and precision translation with max_digits and decimal_places pydantic Decimal field
  • Update docs - add best practices for dependencies
  • Refactor metaclass and model_fields to play nice with type hints
  • Add mypy and pydantic plugin to docs
  • Expand the docs on ManyToMany relation

Fix server_default field parameter and update docs

28 Oct 15:05
0abed59
Compare
Choose a tag to compare

See details in #26

Fix postgresql check to avoid exceptions with drivers not installed

28 Oct 13:24
72438ce
Compare
Choose a tag to compare

Fix json schema generation

27 Oct 17:30
a8f0ec0
Compare
Choose a tag to compare
Pre-release
  • Fix json schema generation as of #19
  • Fix for not initialized ManyToMany relations in fastapi copies of ormar.Models
  • Update docs in regard of fastapi use
  • Add tests to verify fastapi/docs proper generation
  • Modify schema so that ManyToMany fields show list of nested models in fastapi schema