我在这段代码中有一条 pylint 消息(w0707)(来自https://www.django-rest-framework.org/tutorial/3-class-based-views/):
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
Run Code Online (Sandbox Code Playgroud)
信息是:
Consider explicitly re-raising using the 'from' keyword
我不太明白如何采取行动来纠正问题。
预先感谢您的帮助