File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
- from django .dispatch import Signal
3
+ from django .db . models . signals import ModelSignal
4
4
5
- pre_transition = Signal ()
6
- post_transition = Signal ()
5
+ pre_transition = ModelSignal ()
6
+ post_transition = ModelSignal ()
Original file line number Diff line number Diff line change @@ -152,6 +152,15 @@ def test_signals_not_called_on_invalid_transition(self):
152
152
assert not self .post_transition_called
153
153
154
154
155
+ class LazySenderTests (StateSignalsTests ):
156
+ def setUp (self ):
157
+ self .model = SimpleBlogPost ()
158
+ self .pre_transition_called = False
159
+ self .post_transition_called = False
160
+ pre_transition .connect (self .on_pre_transition , sender = "testapp.SimpleBlogPost" )
161
+ post_transition .connect (self .on_post_transition , sender = "testapp.SimpleBlogPost" )
162
+
163
+
155
164
class TestFieldTransitionsInspect (TestCase ):
156
165
def setUp (self ):
157
166
self .model = SimpleBlogPost ()
You can’t perform that action at this time.
0 commit comments