so this is my class based function
class AddCommentView(CreateView):
model = Comment
form_class = CommentForm
template_name = 'app/add_comment.html'
def form_valid(self, form):
list_obj = List.objects.get(slug = self.kwargs['slug'])
form.instance.list = list_obj
return super().form_valid(form)
success_url = reverse_lazy("app:list_detail", kwargs={'slug': List.slug})
once the comment is submitted I wanna go back to detailview page which is
http://127.0.0.1:8000/home/list/best-bangla-art-films2022-09-09-0505595309260000/
but its taking me to
http://127.0.0.1:8000/home/list/best-bangla-art-films2022-09-09-0505595309260000/comment/
any way i can solve this?
in my urls
(I have excluded irrelevant paths)
app_name = "app"
urlpatterns = [
path('', views.HomeView.as_view(),name='home'),
path('list/<slug:slug>/', TheirDetailView.as_view(),name='list_detail'),
path('list/<slug:slug>/comment/',AddCommentView.as_view(),name="add_comment"),
]