Bird
0
0

You wrote a pre_save signal handler but it never runs. Which is the most likely cause?

medium📝 Debug Q6 of 15
Django - Signals
You wrote a pre_save signal handler but it never runs. Which is the most likely cause?
AYou forgot to import the signal module
BYou connected the signal after the model was saved
CYou used <code>post_save</code> instead of <code>pre_save</code>
DYou did not register the signal handler properly
Step-by-Step Solution
Solution:
  1. Step 1: Check signal registration

    If the handler is not registered properly (e.g., missing connect or @receiver), it won't run.
  2. Step 2: Eliminate other causes

    Importing signal module alone doesn't trigger handler; connecting after save is irrelevant; using post_save instead of pre_save changes timing but still runs.
  3. Final Answer:

    You did not register the signal handler properly -> Option D
  4. Quick Check:

    Signal handler must be registered to run [OK]
Quick Trick: Always register signal handlers with connect or @receiver [OK]
Common Mistakes:
MISTAKES
  • Assuming import alone registers handler
  • Thinking signal runs if connected after save
  • Confusing signal type with registration issue

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes