Skip to content

Commit e858f53

Browse files
committed
Release plain-models 0.61.0
1 parent 0b983d9 commit e858f53

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

plain-models/plain/models/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# plain-models changelog
22

3+
## [0.61.0](https://github.com/dropseed/plain/releases/plain-models@0.61.0) (2025-11-14)
4+
5+
### What's changed
6+
7+
- The `related_name` parameter has been removed from `ForeignKey` and `ManyToManyField` - reverse relationships are now declared explicitly using `ReverseForeignKey` and `ReverseManyToMany` descriptors on the related model ([a4b630969d](https://github.com/dropseed/plain/commit/a4b630969d))
8+
- Added `ReverseForeignKey` and `ReverseManyToMany` descriptor classes to `plain.models.types` for declaring reverse relationships with full type support ([a4b630969d](https://github.com/dropseed/plain/commit/a4b630969d))
9+
- The new reverse descriptors are exported from `plain.models` for easy access ([97fa112975](https://github.com/dropseed/plain/commit/97fa112975))
10+
- Renamed internal references from `ManyToOne` to `ForeignKey` for consistency ([93c30f9caf](https://github.com/dropseed/plain/commit/93c30f9caf))
11+
- Fixed a preflight check bug related to reverse relationships ([9191ae6e4b](https://github.com/dropseed/plain/commit/9191ae6e4b))
12+
- Added comprehensive documentation for reverse relationships in the README ([5abf330e06](https://github.com/dropseed/plain/commit/5abf330e06))
13+
14+
### Upgrade instructions
15+
16+
- Remove all `related_name` parameters from `ForeignKey` and `ManyToManyField` definitions
17+
- Remove `related_name` from all migrations
18+
- On the related model, add explicit reverse relationship descriptors using `ReverseForeignKey` or `ReverseManyToMany` from `plain.models.types`:
19+
- For the reverse side of a `ForeignKey`, use: `children: types.ReverseForeignKey[Child] = types.ReverseForeignKey(to="Child", field="parent")`
20+
- For the reverse side of a `ManyToManyField`, use: `cars: types.ReverseManyToMany[Car] = types.ReverseManyToMany(to="Car", field="features")`
21+
- Remove any `TYPE_CHECKING` blocks that were used to declare reverse relationship types - the new descriptors provide full type support without these hacks
22+
- The `to` parameter accepts either a string (model name) or the model class itself
23+
- The `field` parameter should be the name of the forward field on the related model
24+
325
## [0.60.0](https://github.com/dropseed/plain/releases/plain-models@0.60.0) (2025-11-13)
426

527
### What's changed

plain-models/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "plain.models"
3-
version = "0.60.0"
3+
version = "0.61.0"
44
description = "Model your data and store it in a database."
55
authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
66
readme = "README.md"

0 commit comments

Comments
 (0)