Search code examples
djangodjango-signals

Django - admin approve order


I'm working on a project where Users can order a translations. If User creates an order, the translation object is created and message sent to translators. But I want to make admin able to approve each translation.

So after creating an object translation, the admin has to approve it and then something happens.

There is no problem with approval. Just simple Bool attribute in translation model. The problem is that I want to do some things right after approval like sending message to translators etc. I don't know if there is some pattern for this, I was looking for something like ChangeFieldSingal but no success.

Could you tell me how would you do that?


Solution

  • You could override the save() method on your model and check the current value of the flag against a cached value in your Model. You need to override the __init__ method to cache the value:

    https://stackoverflow.com/a/37265149/517560