Skip to content

Commit b7a481d

Browse files
committed
add doc
1 parent 76991fb commit b7a481d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Diff for: CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Bixomix Changelog
22

3-
## Unreleased
3+
## 0.1.1 (unreleased)
44

5+
* Add `EnabledMixin`, `EnabledNoMixin`
6+
* Add `UpdateFromDictMixin`
57
* Document `UpdatedAtMixin`’s compatibility with Postgres (#1)
68

79
## 0.1.0 (2023/03/30)

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2022-2023 – Bixoto.com
1+
Copyright © 2022-2024 – Bixoto.com
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

Diff for: README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ Add mixins after the `Base` class in each model’s parent classes. The order of
1818
```python
1919
from sqlalchemy.orm import DeclarativeBase
2020

21-
from bixomix import CreatedAtMixin
21+
from bixomix import CreatedAtMixin, EnabledMixin
2222

2323

2424
class Base(DeclarativeBase):
2525
pass
2626

2727

28-
class MyModel(Base, CreatedAtMixin):
28+
class MyModel(Base, CreatedAtMixin, EnabledMixin):
2929
# Add your own fields here
3030
...
3131
```
@@ -36,3 +36,6 @@ class MyModel(Base, CreatedAtMixin):
3636
* `UpdatedAtMixin`: add an `updated_at` datetime field that’s automatically filled with the record’s last update date.
3737
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).
3838
* `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

0 commit comments

Comments
 (0)