Complete the code to import the Django signal used before saving a model instance.
from django.db.models.signals import [1]
The pre_save signal is sent just before a model's save() method is called.
Complete the code to connect a function to the post_save signal for a model named Book.
post_save.connect([1], sender=Book)The function connected to a signal should be a handler that processes the event, here named book_saved_handler.
Fix the error in the signal handler definition to accept the correct parameters.
def [1](sender, instance, **kwargs): print(f"Saved: {instance}")
The handler function name should match the one connected to the signal, here book_saved_handler.
Fill both blanks to define a pre_save signal handler that modifies a model's field before saving.
def [1](sender, instance, **kwargs): instance.title = instance.title.[2]()
The handler pre_save_handler modifies the title field to uppercase before saving.
Fill all three blanks to connect a pre_save handler and ensure it only runs for the Author model.
from django.db.models.signals import [1] [2].connect(pre_save_handler, sender=[3])
The pre_save signal is imported and used to connect pre_save_handler for the Author model only.