Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#32054 closed Bug (needsinfo)

Signal disconnect not working with multiple decorators

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 Ronny Vedrilla)

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 :(

Change History (5)

comment:1 by Ronny Vedrilla, 4 years ago

Description: modified (diff)

comment:2 by Carlton Gibson, 4 years ago

Resolution: invalid
Status: newclosed

Sorry, the issue tracker is not a secondary support channel. Please see TicketClosingReasons/UseSupportChannels.

You've done the right thing posting elsewhere (although multiple posting is bad-form) You should wait for a reply, or try to investigate more to help people answer.

If you are able to narrow down a specific issue/behaviour/change then it might be appropriate as a bug report but it's a usage question as it stands.
I hope that makes sense.

comment:3 by Ronny Vedrilla, 4 years ago

Resolution: invalid
Status: closednew

Hi @carton

sorry for not having made myself clear. I do think this is a bug. The docs state explicitly that you can use multiple receivers on a function but the disconnect is not working in this case.

Or am I missing something?

Thanks!
Ronny

comment:4 by Carlton Gibson, 4 years ago

Resolution: needsinfo
Status: newclosed

There's not enough info here for a bug report. (There's not enough info on the SO question to solicit an answer for that matter.)

You need to provide a minimal reproduce example demonstrating what you think is the issue. (It's very likely that in coming up with that you identify your problem.)

As it stands you're asking for help, which is fine, in a single place, but is not appropriate for the issue tracker.
I do hope that makes sense. See TicketClosingReasons/UseSupportChannels

comment:5 by Ronny Vedrilla, 4 years ago

Sure, I'll update my question accordingly. Thanks for your time so far!

Note: See TracTickets for help on using tickets.
Back to Top