Opened 4 years ago
Last modified 4 years ago
#32054 closed Bug
Signal disconnect not working with multiple decorators — at Version 1
Reported by: | Ronny Vedrilla | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.0 |
Severity: | Normal | Keywords: | signals |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Here's my setup on django 3.0.10:
class MyModel(models.Model): pass @receiver(post_save, sender=MyModel) @receiver(post_delete, sender=MyModel) def process_stuff(sender, instance, **kwargs): # to some magic pass
When I want to disconnect the post_save signal like this:
from django.db.models import signals signals.post_save.disconnect( receiver=process_stuff, sender=MyModel,
... it does not work.
If I comment out the second decorator with post_delete
, it works.
If I split this up and use two different functions, it works as well.
I posted at StackOverflow (https://stackoverflow.com/q/64102708/1331671) and in some django groups, but no replies yet.
Seems like a bug to me :(
Note:
See TracTickets
for help on using tickets.