In a ListView
I render a table using the Paginator with paginate_by = 5
. In each row I have a Button that opens the UpdateView
. After a successful update I’m back on my ListView
but always on the first page. How can I change the success_url
so that I’m back on the page number, from where I opened the UpdateView
? Is there a proper way in Django to solve this?
class ApproveCommentPage(PermissionRequiredMixin,UpdateView):
raise_exception = True
permission_required = ("blog.add_commentblog","blog.change_commentblog","blog.delete_commentblog","blog.view_commentblog")
model = BlogComment
template_name = "approve_comment.html"
form_class =AdminComment
def get_success_url(self):
return reverse_lazy('blog-admin')