Hi all, currently when a model signal receiver is registered with an
abstract model as the sender, we allow it even though the receiver will
never be called. It would be nice if the signal registry wasn't polluted by
bogus entries that will never be used.

A few options:

a) Make passing an abstract model to a ModelSignal a no-op, and document
that behaviour. (And possibly: add a return value to ModelSignal.connect()
like we have for disconnect(), and return False when an abstract model is
passed as a sender)

b) Raise a warning, and make it the user's responsibility to check if a
model is abstract before registering it as a sender.

c) Allow it, and make ModelSignal respect inheritance, so that you can
specify a superclass as a sender and the receiver will be called for all
its subclasses, perhaps controlled by an argument to connect().

Perfectly reasonable code like that in django-model-utils [1] does this, so
I don't think it warrants a warning. My inclination is to go with (a).

Cheers,
Alex

[1]
https://github.com/carljm/django-model-utils/blob/c94b65d05f4acd0437a22ef498a80470922a438a/model_utils/fields.py#L106

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CA%2BKBOKzAbyejrwgNrU9r_H3M5B%3D5gJSkxbBr90BxtdUg-91sZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to