0

I was looking at the documentation here, about pre_save and post_save in django. The documentation really does not provide much substance, so what does pre_save and post_save do?

Games Brainiac
  • 80,178
  • 33
  • 141
  • 199

1 Answers1

1

You probably skipped the introduction to signals in the docs:

Django includes a “signal dispatcher” which helps allow decoupled applications get notified when actions occur elsewhere in the framework. In a nutshell, signals allow certain senders to notify a set of receivers that some action has taken place.

Let's say you want to create a slug you have basically two options:

Community
  • 1
  • 1
arie
  • 18,737
  • 5
  • 70
  • 76
  • This is what I was confused about since I always override the `save` method, so I've never needed to use `pre_save` or `post_save`. – Games Brainiac Jul 16 '13 at 06:41
  • 1
    Overriding ```save()``` makes sense in that case. But as soon as your application grows larger and/or you need to take actions in regard to events of an pluggable app you use, signals become really useful. – arie Jul 16 '13 at 06:46