Complete the code to import the Django signal dispatcher.
from django.dispatch import [1]
The Signal class is imported from django.dispatch to create custom signals.
Complete the code to connect a receiver function to a signal.
my_signal.[1](receiver=my_receiver)The connect method links a receiver function to a signal so it gets called when the signal is sent.
Fix the error in sending a signal with a sender argument.
my_signal.send(sender=[1])The sender argument should be the class or object that sends the signal, often a model class like MyModel.
Fill both blanks to define and send a custom signal with a named argument.
my_signal = Signal(providing_args=[[1]]) my_signal.send(sender=MyModel, [2]=42)
The signal is defined to provide an argument named 'count' (string in list). When sending, the argument is passed as a keyword without quotes.
Fill all three blanks to create a receiver function and connect it to a signal.
@receiver([1], sender=[2]) def my_receiver(sender, **kwargs): print([3])
The @receiver decorator connects my_receiver to my_signal with sender MyModel. Inside, it prints the 'count' argument from kwargs.