Django Rest Framework - “detalhe”: “Não encontrado.”
Olá, ao fazer esta solicitação: groups / 25010a31-fc5b-47c8-9c5c-d740e5743f52 / members / 4 / - recebo "detail": "Not found"
No entanto, se você olhar no conjunto de consultas, imprimi a instância Groupmember e isso acaba imprimindo essa instância específica com tanta clareza que existe?
Visão:
class MemberDetail(mixins.RetrieveModelMixin,
mixins.DestroyModelMixin,
mixins.UpdateModelMixin,
generics.GenericAPIView):
serializer_class = GroupMembersSerializer
lookup_field = "user_id"
lookup_url_kwarg = "uuid"
def get_queryset(self):
group = self.kwargs["uuid"]
user_id = self.kwargs["user_id"]
print GroupMember.objects.get(group = group, user_id = user_id)
return GroupMember.objects.get(group = group, user_id = user_id)
def get(self, request, *args, **kwargs):
return self.retrieve(self, request, *args, **kwargs)
def put(self, request, *args, **kwargs):
return self.update(self, request, *args, **kwargs)
def delete(self, request, *args, **kwargs):
return self.destroy(self, request, *args, **kwargs)
URLs:
urlpatterns = [
url(r'^$', views.GroupList.as_view()),
url(r'^(?P<uuid>[^/]+)/$', views.GroupDetail.as_view()),
url(r'^(?P<uuid>[^/]+)/members/$', views.MemberList.as_view()),
url(r'^(?P<uuid>[^/]+)/members/(?P<user_id>[0-9]+)/$', views.MemberDetail.as_view()),
]
Qualquer ajuda?