Success_url not working with url that-has/<int:pk>

The success_url is workin fine with a url that has-no/int:pk but does not work with a url that has /int:pk throws an error NoReverseMatch: Reverse for 'read_bty'.

Views.py

class HBTYOrderView(BSModalCreateView):
template_name = 'accounts/modals/hairbty/create_hbty.html'
form_class = HairbtyOrderForm
success_message = 'Success: Order was created.'
success_url = reverse_lazy('read-bty')

Urls.py

    path('create_btyorder/', views.HBTYOrderView.as_view(), name='create_btyorder'),
    path('read_bty/<int:pk>', views.HBTYReadView.as_view(), name='read_bty'),

Try to change it to:

path('read_bty/<int:id>/', views.HBTYReadView.as_view(), name='read_bty'),
Back to Top