Django: how can I tell if the post_save signal triggers on a new object?
问题 I need to do some background post-processing on newly created objects in Django. This post-processing should only run on new objects, not objects that are just updated. I know that in pre_save I can check if the object has an id, if it has not then it's a new object. But the problem is that in the post-processing I need access to the id (so that I can save the results back to the database). How can I do this in a clean way? 回答1: Have a look at docs: https://docs.djangoproject.com/en/stable