djangodjango-rest-frameworkdjango-rest-auth

Remove user endpoints in Django rest auth


I am using Django rest auth for user account handling. For updating user info i have created custom endpoints, So i don't need the djnago-rest-auth generated endpoints /rest-auth/user/ (GET, PUT, PATCH). How can i remove these endpoints?

urls.py

urlpatterns = [
    path('', include("rest_auth.urls"), name="user-auth"),
    path('register', include('rest_auth.registration.urls'), name="user-auth-registration"),
    path('<uid>/', views.UserProfileView.as_view(), name="user-profile"),
]

Edit

I want to use all other urls of rest-auth like login, register, etc. But i just dont want the /rest-auth/user/ as described here.


Solution

  • @bodoubleu 's answer didn't work, So i added them manually.

    from rest_auth.views import (
        LoginView, LogoutView, PasswordChangeView,
        PasswordResetView, PasswordResetConfirmView
    )
    
    urlpatterns = [
        path('register', include('rest_auth.registration.urls'), name="user-auth-registration"),
        path('login', LoginView.as_view(), name="user-login"),
        path('logout', LogoutView.as_view(), name='user-logout'),
        path('password/change/', PasswordChangeView.as_view(), name='rest_password_change'),
        path('password/reset', PasswordResetView.as_view(), name='rest_password_reset'),
        path('password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'),
        path('<uid>/', views.UserProfileView.as_view(), name="user-profile"),
    ]