mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #26642 -- Made ModelSignal.disconnect() work with lazy references.
This commit is contained in:
parent
9bb1b4b7f6
commit
ff6c6feae1
2 changed files with 37 additions and 7 deletions
|
@ -301,3 +301,19 @@ class LazyModelRefTest(BaseSignalTest):
|
|||
}])
|
||||
finally:
|
||||
signals.post_init.disconnect(self.receiver, sender=Created)
|
||||
|
||||
@isolate_apps('signals', kwarg_name='apps')
|
||||
def test_disconnect(self, apps):
|
||||
received = []
|
||||
|
||||
def receiver(**kwargs):
|
||||
received.append(kwargs)
|
||||
|
||||
signals.post_init.connect(receiver, sender='signals.Created', apps=apps)
|
||||
signals.post_init.disconnect(receiver, sender='signals.Created', apps=apps)
|
||||
|
||||
class Created(models.Model):
|
||||
pass
|
||||
|
||||
Created()
|
||||
self.assertEqual(received, [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue