Backend Development
Django
Subjective
Oct 03, 2025
What are Django signals and when to use them?
Detailed Explanation
Signals allow decoupled applications to get notified when actions occur.
Common signals:
• pre_save, post_save
• pre_delete, post_delete
• m2m_changed
Use cases:
• Logging
• Cache invalidation
• Email notifications
• Profile creation
Example:
@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
# Profile creation logic
Benefits:
• Loose coupling
• Event-driven architecture
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts