Skip to content

Version 0.12.0

Compare
Choose a tag to compare
@tarsil tarsil released this 28 Jun 13:58
· 97 commits to main since this release
8fc8c33

Added

  • Allow multiple ForeignKeys with the same related_name in one model.
  • Support ForeignKeys on multiple columns.
  • Allow selecting columns for ForeignKeys.
  • Allow skipping creating a ForeignKeyConstraint.
  • Add ExcludeField for masking fields in submodels.
  • ManyToMany fields pass unique through to target foreignkey.
  • Add ConditionalRedirect constant for CompositeField.
  • Embeddables via CompositeField. See Embedding
  • Add ForeignKeyFactory, a factory with presets for building foreign keys.
  • Multiple primary keys and names different from "id" are possible now.
  • Add inherit flag for Manager, BaseFields and Models (when used as an embeddable). It is used for controlling the inheritance.
  • Managers are now instance aware. You can customize the instance and they can react. They are also shallow copied for every class and instance.
  • Improved Relations (reverse side of ForeignKeys and forward side of Many2Many). Have now add and remove methods and work like RefForeignKey (you can just specify an Array with assignment targets and they will be added).
  • Allow skip building reverse RelatedFields for ForeignKeys with related_name=False.
  • pkcolumns attribute of models (contains all found primary key columns).
  • Some new methods on BaseField:
    • embed_field: for controlling embedding a field in an CompositeField.
    • get_column_names: helper function for retrieving the column names of a field.
  • Add RelationshipField for traversable fields.

Changed

  • ForeignKeys use now global constraints and indexes.
  • Breaking: clean has now the argument to_query. See Custom Fields.
  • Breaking: ManyToMany doesn't have a RelatedField on owner anymore and uses proxying. See ManyToMany.
  • Breaking: use singular related_name for unique ForeignKeys (or OneToOne). See related_name
  • MetaInfo (meta) is now partly lazy.
  • pk is now a PKField (a variant of the BaseCompositeField).
  • clean and to_columns of BaseField do return empty objects instead of raising NotImplementedError.
  • Major refactory of ForeignKeys, move logic for single ForeignKeys to subclass.
  • Move FieldFactory and ForeignKeyFieldFactory to factories.
  • Remove superfluous BaseOneToOneKeyField. Merged into BaseForeignKeyField.
  • Remove unused attributes of MetaInfo and added some lazy evaluations for fields.

Breaking

  • Prefetch traversal of foreign keys uses now the foreign key name. For the traversal of RelatedFields everything stays the same.

What's Changed

Full Changelog: 0.11.1...0.12.0