You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project provides a `@hook` decorator as well as a base model and mixin to add lifecycle hooks to your Django models. Django's built-in approach to offering lifecycle hooks is [Signals](https://docs.djangoproject.com/en/dev/topics/signals/). However, my team often finds that Signals introduce unnecessary indirection and are at odds with Django's "fat models" approach.
10
9
11
10
**Django Lifecycle Hooks** supports Python 3.5, 3.6, 3.7, 3.8 and 3.9, Django 2.0.x, 2.1.x, 2.2.x, 3.0.x and 3.1.x.
@@ -35,13 +34,13 @@ Instead of overriding `save` and `__init__` in a clunky way that hurts readabili
* Fixes `initial_value(field_name)` behavior - should return value even if no change. Thanks @adamJLev!
127
+
128
+
- Fixes `initial_value(field_name)` behavior - should return value even if no change. Thanks @adamJLev!
111
129
112
130
## 0.3.2 (February 2019)
113
-
* Fixes bug preventing hooks from firing for custom PKs. Thanks @atugushev!
131
+
132
+
- Fixes bug preventing hooks from firing for custom PKs. Thanks @atugushev!
114
133
115
134
## 0.3.1 (August 2018)
116
-
* Fixes m2m field bug, in which accessing auto-generated reverse field in `before_create` causes exception b/c PK does not exist yet. Thanks @garyd203!
135
+
136
+
- Fixes m2m field bug, in which accessing auto-generated reverse field in `before_create` causes exception b/c PK does not exist yet. Thanks @garyd203!
117
137
118
138
## 0.3.0 (April 2018)
119
-
* Resets model's comparison state for hook conditions after `save` called.
139
+
140
+
- Resets model's comparison state for hook conditions after `save` called.
120
141
121
142
## 0.2.4 (April 2018)
122
-
* Fixed support for adding multiple `@hook` decorators to same method.
143
+
144
+
- Fixed support for adding multiple `@hook` decorators to same method.
123
145
124
146
## 0.2.3 (April 2018)
125
-
* Removes residual mixin methods from earlier implementation.
147
+
148
+
- Removes residual mixin methods from earlier implementation.
126
149
127
150
## 0.2.2 (April 2018)
128
-
* Save method now accepts `skip_hooks`, an optional boolean keyword argument that controls whether hooked methods are called.
151
+
152
+
- Save method now accepts `skip_hooks`, an optional boolean keyword argument that controls whether hooked methods are called.
129
153
130
154
## 0.2.1 (April 2018)
131
-
* Fixed bug in `_potentially_hooked_methods` that caused unwanted side effects by accessing model instance methods decorated with `@cache_property` or `@property`.
155
+
156
+
- Fixed bug in `_potentially_hooked_methods` that caused unwanted side effects by accessing model instance methods decorated with `@cache_property` or `@property`.
132
157
133
158
## 0.2.0 (April 2018)
134
-
* Added Django 1.8 support. Thanks @jtiai!
135
-
* Tox testing added for Python 3.4, 3.5, 3.6 and Django 1.8, 1.11 and 2.0. Thanks @jtiai!
159
+
160
+
- Added Django 1.8 support. Thanks @jtiai!
161
+
- Tox testing added for Python 3.4, 3.5, 3.6 and Django 1.8, 1.11 and 2.0. Thanks @jtiai!
136
162
137
163
# Testing
138
164
139
-
Tests are found in a simplified Django project in the ```/tests``` folder. Install the project requirements and do ```./manage.py test``` to run them.
165
+
Tests are found in a simplified Django project in the `/tests` folder. Install the project requirements and do `./manage.py test` to run them.
0 commit comments