如何排除post方法并在drf_yasg中添加描述

时间:2019-06-06 13:46:41

标签: django drf-yasg

我正在使用带有swagger ui的drf_yasg来记录我们的Django应用,试图排除post方法不起作用,也没有操作说明

@method_decorator(name='create', decorator=swagger_auto_schema(auto_schema=None))
@method_decorator(name='list', decorator=swagger_auto_schema(operation_description="GET /dashboards"))
class DashboardAPIView(ListCreateAPIView):
    """
    View class that extends the Django rest framework generic view ListCreateAPIView
    to perform GET and POST operations for Dashboards
    """
    queryset = Dashboards.objects.all().order_by('dash_name')
    serializer_class = DashboardSerializer

    def perform_create(self, serializer):
        sequence_no = get_next_sequence_number_test_dashboard()
        serializer.save(sequence_no=sequence_no)

期望的职位被排除在外,并显示隐藏标题,但没有

dashboards
GET
​/dashboards
dashboards_list
POST
​/dashboards
dashboards_create

0 个答案:

没有答案