1. 错误:
AssertionError: Expected view CourseDetailRetrieveAPIView to be called with a URL keyword argument named "pk".
Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
2.错误截图
3.错误描述:
a. 用django有名分组的时候,出现的错误
b. 使用了drf的RetrieveAPIView视图
4. 错误原因:
pk是小写的但是我写成大写的了
5.解决:
a. 把有名分组的pk给改成小写即可
b. 如果你没有向我一样,使用了drf而报了这个错,那你只需要在视图中添加该参数即可
def get(request, pk):
pass