1👍
✅
You need to use redirect
, not render
, and you need to pass it the values to populate the URL.
return redirect('post_detail', kwargs={'year': post.publish.year, 'month': post.publish.month, 'day': post.publish.day, 'post': post.slug})
0👍
Maybe you can use the built-in library of django which is redirect,
just import it by “from django.shortcuts import redirect
”
and you do this:
return redirect('url-name',{'posts': posts, 'form': form})
hope this will help.
Source:stackexchange.com