Django error - matching query does not exist

后端 未结 4 1180
礼貌的吻别
礼貌的吻别 2020-12-24 11:25

I finally released my project to the production level and suddenly I have some issues I never had to deal with in the development phase.

When the users posts some ac

4条回答
  •  一生所求
    2020-12-24 11:44

    You may try this way. just use a function to get your object

    def get_object(self, id):
        try:
            return Comment.objects.get(pk=id)
        except Comment.DoesNotExist:
            return False
    

提交回复
热议问题