How do I remove the path below from my API documentation with my current code?
path('users/reset/<uidb64>/<token>/', PasswordResetConfirmView.as_view()),
I don't want this path to be generated since it's not apart of my API.
I’m using drf_yasg to generate re-doc and swagger documentation.
Screenshot of what I'm currently seeing:
Below is some of what's under the hood of urls.py
.
urls.py
from rest_framework.documentation import include_docs_urls
from rest_framework.schemas import get_schema_view
from rest_framework import permissions
from allauth.account.views import ConfirmEmailView, EmailVerificationSentView
from dj_rest_auth.views import PasswordResetConfirmView
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
API_TITLE = ‘Test API
API_DESCRIPTION = ‘Test ‘Description
schema_view = get_schema_view(
openapi.Info(
title=“title-test”,
default_version='v1',
description=“blah blah.”,
),
public=True,
permission_classes=(permissions.IsAuthenticated,),
)
urlpatterns = [
# AllAuth Authentication
path('accounts/', include('allauth.urls')),
# Django REST API Paths
path('api/', include('api.urls')),
path('api-auth/', include('rest_framework.urls')),
# ConfirmEmailView Needs to be defined before the registration path
path('api/dj-rest-auth/registration/account-confirm-email/<str:key>/',
ConfirmEmailView.as_view()),
path('api/dj-rest-auth/', include('dj_rest_auth.urls')),
path('api/dj-rest-auth/registration/', include('dj_rest_auth.registration.urls')),
path('api/dj-rest-auth/registration/account-confirm-email/',
EmailVerificationSentView.as_view(), name='account_email_verification_sent'),
# path('api/dj-rest-auth/reset/<uidb64>/<token>/', PasswordResetConfirmView.as_view()),
# API Documentation Paths
path('docs/', include_docs_urls(title="GameStation API", description=API_DESCRIPTION)),
# path('schema/', schema_view),
path('swagger<format>/', schema_view.without_ui(cache_timeout=0), name='schema-json'),
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
## This path is what I’m trying to remove
path('users/reset/<uidb64>/<token>/', PasswordResetConfirmView.as_view()),
]
So instead of excluding:
I removed it completely. After that url is removed now my documentation reads accordingly:
Also, my backend looks like this once a user punches in the url that the password reset email spits out:
This works fine since I'm using allauth for registration/authentication now and this is only for the django back-end API stuff.
Side note: This is only happening on the django back-end. When a users fills out the password-reset form on the front-end the url that gets spits out is the following:
Not sure why there's a difference. But there is.
If I need devs to confirm a token with an ID I can just point them to: