File tree 3 files changed +9
-4
lines changed
3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Bixomix Changelog
2
2
3
- ## Unreleased
3
+ ## 0.1.1 (unreleased)
4
4
5
+ * Add ` EnabledMixin ` , ` EnabledNoMixin `
6
+ * Add ` UpdateFromDictMixin `
5
7
* Document ` UpdatedAtMixin ` ’s compatibility with Postgres (#1 )
6
8
7
9
## 0.1.0 (2023/03/30)
Original file line number Diff line number Diff line change 1
- Copyright © 2022-2023 – Bixoto.com
1
+ Copyright © 2022-2024 – Bixoto.com
2
2
3
3
Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
this software and associated documentation files (the "Software"), to deal in
Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ Add mixins after the `Base` class in each model’s parent classes. The order of
18
18
``` python
19
19
from sqlalchemy.orm import DeclarativeBase
20
20
21
- from bixomix import CreatedAtMixin
21
+ from bixomix import CreatedAtMixin, EnabledMixin
22
22
23
23
24
24
class Base (DeclarativeBase ):
25
25
pass
26
26
27
27
28
- class MyModel (Base , CreatedAtMixin ):
28
+ class MyModel (Base , CreatedAtMixin , EnabledMixin ):
29
29
# Add your own fields here
30
30
...
31
31
```
@@ -36,3 +36,6 @@ class MyModel(Base, CreatedAtMixin):
36
36
* ` UpdatedAtMixin ` : add an ` updated_at ` datetime field that’s automatically filled with the record’s last update date.
37
37
Note that on Postgres this is done in Python; for a database-level update you have to [ create a trigger] ( https://stackoverflow.com/a/71072370/735926 ) .
38
38
* ` CreatedUpdatedAtMixin ` : combined version of the previous two mixins
39
+ * ` EnabledMixin ` : add an ` enabled ` boolean field (default is ` true ` )
40
+ * ` EnabledNoMixin ` : same as ` EnabledMixin ` , but the default value is ` false `
41
+ * ` UpdateFromDictMixin ` : add an ` update_from_dict ` method to update a model in-place given a dictionary of attributes
You can’t perform that action at this time.
0 commit comments