1

I'm using Django paginator in CBV, and after form submit (creates new post) I'm trying to redirect to actual page with newly created post. I'm using reverse_lazy with keyword argument for page number, but in URL generated with reverse_lazy, ? sign on the beginning is changed to %3F, e.g. ?page=7->%3Fpage=7. And consequently, I get redirected to first page.

My URL path:

path("homeT/?page=<int:num>", views.homeTestView.as_view(), name="actual_page"),

I use reverse_lazy like this:

return reverse_lazy("actual_page", kwargs={'num': page_num})

P.S. And is there a easier way to get redirect to page with newly created post/comment?? Thank you.

oguz ismail
  • 1
  • 16
  • 47
  • 69

1 Answers1

2

Ok, i solved this with using such "hardcoded" approach: return reverse("homeT") + "?page=%s" % page_num. And redirect to page with newly created post is described Here