Search code examples
pythonajaxdjangodjango-signals

How to receive Django post_save signal on AJAX query?


I use AJAX request to create an order, also I have a post_save signal that should be executed after the order will save. Whether is it possible to receive this post_save signal on an AJAX request?.. because I don't get aything, the signal handler is ignored =|


Solution

  • 1. Okay. After I have read whole documentation of signals in depth I didn't find anything that helped me to solve the prolem. Then I have read this post that describe the signals at great length. So, I forget to add the default_app_config in the __init__.py of my module:

    default_app_config = 'cmdbox.profiles.apps.ProfilesConfig'
    

    Hope this hint will help someone like me)

    2. The answer for the main question, thanks to the Daniel Roseman:

    If you have a post-save signal, it is always sent on save. It has nothing to do with whether the original request is Ajax or not.