Django: Signals vs Overriding Save

September 14, 2025 1 min read 0 views

You want to do something when a User is created (e.g., create a Profile).

Signals (post_save)

Python
@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
    if created:
        Profile.objects.create(user=instance)
  • Pros: Decoupled. Good for 3rd party apps.
  • Cons: Hard to debug (Action at a distance).

Overriding .save()

Python
class User(models.Model):
    def save(self, *args, **kwargs):
        is_new = self.pk is None
        super().save(*args, **kwargs)
        if is_new:
            Profile.objects.create(user=self)
  • Pros: Explicit. You see exactly what happens.
  • Cons: Only works if you control the Model code.

Verdict

Prefer Overriding .save() for your own models. It's clearer. Use Signals only when hooking into 3rd party code (like Django's User model) or when avoiding circular imports.

Similar Posts