Is Django post_save signal asynchronous?

后端 未结 4 1663
小鲜肉
小鲜肉 2020-12-04 16:27

I have a like function which is just like social networks like or thumbs up function; the user clicks the star / heart / whatever to mark the content as liked.I

4条回答
  •  借酒劲吻你
    2020-12-04 17:28

    Hm, first of all signals in Django are not asynchronous. For your particular case I think post_save is the wrong way to go. The most straightforward way is simply to fire an ajax request to view which do your like action and don't wait for the response. Instead modify your view/html directly after you fired the request.

    That would of course require that you know beforehand that your user is allowed to like this item and that your request will not fail.

提交回复
热议问题