plain.models 0.39.0__py3-none-any.whl → 0.39.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plain/models/CHANGELOG.md +12 -0
- plain/models/README.md +28 -0
- {plain_models-0.39.0.dist-info → plain_models-0.39.1.dist-info}/METADATA +29 -1
- {plain_models-0.39.0.dist-info → plain_models-0.39.1.dist-info}/RECORD +7 -7
- {plain_models-0.39.0.dist-info → plain_models-0.39.1.dist-info}/WHEEL +0 -0
- {plain_models-0.39.0.dist-info → plain_models-0.39.1.dist-info}/entry_points.txt +0 -0
- {plain_models-0.39.0.dist-info → plain_models-0.39.1.dist-info}/licenses/LICENSE +0 -0
plain/models/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# plain-models changelog
|
2
2
|
|
3
|
+
## [0.39.1](https://github.com/dropseed/plain/releases/plain-models@0.39.1) (2025-07-22)
|
4
|
+
|
5
|
+
### What's changed
|
6
|
+
|
7
|
+
- Added documentation for sharing fields across models using Python class mixins ([cad3af01d2](https://github.com/dropseed/plain/commit/cad3af01d2))
|
8
|
+
- Added note about `PrimaryKeyField()` replacement requirement for migrations ([70ea931660](https://github.com/dropseed/plain/commit/70ea931660))
|
9
|
+
|
10
|
+
### Upgrade instructions
|
11
|
+
|
12
|
+
- No changes required
|
13
|
+
|
3
14
|
## [0.39.0](https://github.com/dropseed/plain/releases/plain-models@0.39.0) (2025-07-22)
|
4
15
|
|
5
16
|
### What's changed
|
@@ -18,6 +29,7 @@
|
|
18
29
|
- Remove any `to_field` arguments from ForeignKey definitions - they are no longer supported
|
19
30
|
- Remove any `parent_link=True` arguments from ForeignKey definitions - they are no longer supported
|
20
31
|
- Replace any usage of `InlineForeignKeyField` in forms with standard form fields
|
32
|
+
- `models.BigAutoField(auto_created=True, primary_key=True)` need to be replaced with `models.PrimaryKeyField()` in migrations
|
21
33
|
|
22
34
|
## [0.38.0](https://github.com/dropseed/plain/releases/plain-models@0.38.0) (2025-07-21)
|
23
35
|
|
plain/models/README.md
CHANGED
@@ -106,3 +106,31 @@ TODO
|
|
106
106
|
## Forms
|
107
107
|
|
108
108
|
TODO
|
109
|
+
|
110
|
+
## Sharing fields across models
|
111
|
+
|
112
|
+
To share common fields across multiple models, use Python classes as mixins. The final, registered model must inherit directly from `models.Model` and the mixins should not.
|
113
|
+
|
114
|
+
```python
|
115
|
+
from plain import models
|
116
|
+
|
117
|
+
|
118
|
+
# Regular Python class for shared fields
|
119
|
+
class TimestampedMixin:
|
120
|
+
created_at = models.DateTimeField(auto_now_add=True)
|
121
|
+
updated_at = models.DateTimeField(auto_now=True)
|
122
|
+
|
123
|
+
|
124
|
+
# Models inherit from the mixin AND models.Model
|
125
|
+
@models.register_model
|
126
|
+
class User(TimestampedMixin, models.Model):
|
127
|
+
email = models.EmailField()
|
128
|
+
password = PasswordField()
|
129
|
+
is_admin = models.BooleanField(default=False)
|
130
|
+
|
131
|
+
|
132
|
+
@models.register_model
|
133
|
+
class Note(TimestampedMixin, models.Model):
|
134
|
+
content = models.TextField(max_length=1024)
|
135
|
+
liked = models.BooleanField(default=False)
|
136
|
+
```
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: plain.models
|
3
|
-
Version: 0.39.
|
3
|
+
Version: 0.39.1
|
4
4
|
Summary: Database models for Plain.
|
5
5
|
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
6
6
|
License-File: LICENSE
|
@@ -117,3 +117,31 @@ TODO
|
|
117
117
|
## Forms
|
118
118
|
|
119
119
|
TODO
|
120
|
+
|
121
|
+
## Sharing fields across models
|
122
|
+
|
123
|
+
To share common fields across multiple models, use Python classes as mixins. The final, registered model must inherit directly from `models.Model` and the mixins should not.
|
124
|
+
|
125
|
+
```python
|
126
|
+
from plain import models
|
127
|
+
|
128
|
+
|
129
|
+
# Regular Python class for shared fields
|
130
|
+
class TimestampedMixin:
|
131
|
+
created_at = models.DateTimeField(auto_now_add=True)
|
132
|
+
updated_at = models.DateTimeField(auto_now=True)
|
133
|
+
|
134
|
+
|
135
|
+
# Models inherit from the mixin AND models.Model
|
136
|
+
@models.register_model
|
137
|
+
class User(TimestampedMixin, models.Model):
|
138
|
+
email = models.EmailField()
|
139
|
+
password = PasswordField()
|
140
|
+
is_admin = models.BooleanField(default=False)
|
141
|
+
|
142
|
+
|
143
|
+
@models.register_model
|
144
|
+
class Note(TimestampedMixin, models.Model):
|
145
|
+
content = models.TextField(max_length=1024)
|
146
|
+
liked = models.BooleanField(default=False)
|
147
|
+
```
|
@@ -1,5 +1,5 @@
|
|
1
|
-
plain/models/CHANGELOG.md,sha256=
|
2
|
-
plain/models/README.md,sha256=
|
1
|
+
plain/models/CHANGELOG.md,sha256=7E1ExS5gP9KotEEmAHBG-fOI6XbidxQhLW_xtppI_P0,7688
|
2
|
+
plain/models/README.md,sha256=c5Z7YHxsS72mBS9SZuVoJhudwuAQJDm7tYBeh5fwib0,2591
|
3
3
|
plain/models/__init__.py,sha256=LJhlJauhTfUySY2hTJ9qBhCbEKMxTDKpeVrjYXZnsCw,2964
|
4
4
|
plain/models/aggregates.py,sha256=P0mhsMl1VZt2CVHMuCHnNI8SxZ9citjDLEgioN6NOpo,7240
|
5
5
|
plain/models/base.py,sha256=FJlWJ_LUdjk3Bizi45R4IsYzcuLAoiUHS-R3FxxNmWk,66857
|
@@ -114,8 +114,8 @@ plain/models/sql/where.py,sha256=ezE9Clt2BmKo-I7ARsgqZ_aVA-1UdayCwr6ULSWZL6c,126
|
|
114
114
|
plain/models/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
115
115
|
plain/models/test/pytest.py,sha256=KD5-mxonBxOYIhUh9Ql5uJOIiC9R4t-LYfb6sjA0UdE,3486
|
116
116
|
plain/models/test/utils.py,sha256=S3d6zf3OFWDxB_kBJr0tDvwn51bjwDVWKPumv37N-p8,467
|
117
|
-
plain_models-0.39.
|
118
|
-
plain_models-0.39.
|
119
|
-
plain_models-0.39.
|
120
|
-
plain_models-0.39.
|
121
|
-
plain_models-0.39.
|
117
|
+
plain_models-0.39.1.dist-info/METADATA,sha256=9C2WDp2OBOj6T60Htwy_opbFjwxjW4R1CnAk6pYub1Y,2886
|
118
|
+
plain_models-0.39.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
119
|
+
plain_models-0.39.1.dist-info/entry_points.txt,sha256=IYJAW9MpL3PXyXFWmKmALagAGXC_5rzBn2eEGJlcV04,112
|
120
|
+
plain_models-0.39.1.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
|
121
|
+
plain_models-0.39.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|