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 11from __future__ import annotations
22
3- from django .dispatch import Signal
3+ from django .db . models . signals import ModelSignal
44
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):
152152 assert not self .post_transition_called
153153
154154
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+
155164class TestFieldTransitionsInspect (TestCase ):
156165 def setUp (self ):
157166 self .model = SimpleBlogPost ()
You can’t perform that action at this time.
0 commit comments