post_save signal vs model's save()

27 views
Skip to first unread message

Alan Evangelista

unread,
Feb 16, 2022, 9:26:08 PM2/16/22
to Django users
Hi!

I have a Django model for a dynamic application whose questions depend on data previously provided by the user. I also have a Django model for each question/answer in this application. There is a front-end that calls the back-end to "auto-save" whenever a question is answered.

When the user provides their website, I will create a async task that will call an external API that will perform a security check on the user's website, looking for some vulnerabilities, and save the result back to the application model. I can create this async task in the application answer model's save() method or register a function to be called on the post_save signal. 

What are the pros/cons of using one or the another approach? At first sight, using save() seems simpler to me.

Regards,
Alan
Reply all
Reply to author
Forward
0 new messages