最佳答案
在这段代码(来自 https://www.django-rest-framework.org/tutorial/3-class-based-views/)上有一条 pylint 消息(w0707) :
class SnippetDetail(APIView):
"""
Retrieve, update or delete a snippet instance.
"""
def get_object(self, pk):
try:
return Snippet.objects.get(pk=pk)
except Snippet.DoesNotExist:
raise Http404
信息是:
Consider explicitly re-raising using the 'from' keyword
我不太明白如何采取行动来纠正这个问题。