Bird
0
0

Why is it recommended to use the @receiver decorator instead of manually connecting signal handlers with signal.connect()?

hard📝 Conceptual Q10 of 15
Django - Signals
Why is it recommended to use the @receiver decorator instead of manually connecting signal handlers with signal.connect()?
ABecause @receiver improves code readability and avoids manual connect calls
BBecause @receiver automatically handles disconnecting signals on app reload
CBecause signal.connect() is deprecated in Django
DBecause @receiver runs handlers asynchronously by default
Step-by-Step Solution
Solution:
  1. Step 1: Understand benefits of @receiver decorator

    The decorator makes signal connection clear and keeps related code together, improving readability.
  2. Step 2: Compare with manual connect calls

    Manual connect calls require extra code and can be scattered, making maintenance harder.
  3. Final Answer:

    Because @receiver improves code readability and avoids manual connect calls -> Option A
  4. Quick Check:

    @receiver improves clarity and reduces manual code [OK]
Quick Trick: Use @receiver for cleaner, readable signal connections [OK]
Common Mistakes:
MISTAKES
  • Thinking signal.connect() is deprecated
  • Assuming @receiver disconnects automatically
  • Believing @receiver runs handlers asynchronously

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes