【发布时间】:2020-09-19 11:42:46
【问题描述】:
我在views.py中定义了这个类:
class EditOrderStudents(generics.RetrieveUpdateDestroyAPIView): #permission_classes = (permissions.AllowAny,) authentication_classes = (TokenAuthentication , ) serializer_class =newOrdersStudentSerializidGet def get_queryset(self): id = self.request.query_params.get('id') queryset = newOrdersStudent.objects.filter(Groupid=(id)) return queryset
我使用RetrieveUpdateDestroyAPIView 泛型来放置、删除和获取方法
但是我得到了这个错误,我不知道是什么问题?
AssertionError: Expected view EditOrderStudents to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
【问题讨论】: