Django might not found api endpoint with slug
I have ViewSets with using action decorator.
All actions with slug work.
But there is one action which return Page not found
class DefectImageViewSet(GenericViewSet):
queryset = DefectImage.objects.all()
serializer_class = DefectImageListSerializer
@action(
methods=['get'],
detail=False,
url_path='<uuid:defect_id>', # This method not work in current case,
# but I using this definition method of slug everywhere
# and it work
# url_path=r'(?P<defect_id>[^/.]+)', # This is work in current case
url_name='image-list'
)
def get_list(self, request, defect_id):
queryset: QuerySet = self.get_queryset()
queryset = queryset.filter(defect_id=defect_id)
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)
I tried to remove slug and set default value and all work, but as soon as I add a slug, it returns Page not found