所以我的模板中有一个部分:
<div id='comments'>Comments go here</div>
现在我希望我的 django 重定向功能重定向到此页面并跳转到此 div id。
return redirect('post_detail', post.slug)
我该放在哪里'/#comments'
让它在重定向时跳转到那里
redirect (reverse('post_detail', post.slug) + '#comments')
https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#examples https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#examples
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)