Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从Django内置API文档中排除rest auth端点?_Python_Django_Django Rest Framework_Swagger_Django Rest Auth - Fatal编程技术网

Python 如何从Django内置API文档中排除rest auth端点?

Python 如何从Django内置API文档中排除rest auth端点?,python,django,django-rest-framework,swagger,django-rest-auth,Python,Django,Django Rest Framework,Swagger,Django Rest Auth,要在Django文档中隐藏端点,只需将@schema(None)添加到GenericAPIView,但是这两个URL有问题: url(r'^rest-auth/', include('rest_auth.urls')), url(r'^rest-auth/registration/', include('rest_auth.registration.urls')), 我无法添加@schema(None)decorator,因为我没有这些URL的声明视图。有什么办法吗?我想出的解决方案: (vf

要在Django文档中隐藏端点,只需将
@schema(None)
添加到
GenericAPIView
,但是这两个URL有问题:

url(r'^rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),

我无法添加
@schema(None)
decorator,因为我没有这些URL的声明视图。有什么办法吗?

我想出的解决方案:

(vf, app_name, namespace) = include('rest_auth.urls')

vf.LoginView = schema(None)(vf.LoginView)
vf.LoginView = schema(None)(vf.LogoutView)
vf.LoginView = schema(None)(vf.PasswordChangeView)
vf.LoginView = schema(None)(vf.PasswordResetConfirmView)
vf.LoginView = schema(None)(vf.PasswordResetView)
vf.LoginView = schema(None)(vf.UserDetailsView)

(vf_registration, app_name_registration, namespace_registration) = include('rest_auth.registration.urls')

vf_registration.RegisterView = schema(None)(vf_registration.RegisterView)
vf_registration.TemplateView = schema(None)(vf_registration.TemplateView)
vf_registration.VerifyEmailView = schema(None)(vf_registration.VerifyEmailView)

urlpatterns = [

    url(r'^rest-auth/', (vf, app_name, namespace)),
    url(r'^rest-auth/registration/', (vf_registration, app_name_registration, namespace_registration)),
]