template_showpost

Posted exploer

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了template_showpost相关的知识,希望对你有一定的参考价值。

使用<a href=‘...‘>name<a>实现点击"name"与转向‘...‘网址的超链接操作

from django.shortcut import redirect导入redirect方法:  return redirect(‘/‘)实现返回首页

def showpost(request, slug):
template = get_template(‘post.html‘)
try:
post = Post.objects.get(slug=slug)
if post != None:
html = template.render(locals())
return HttpResponse(html)
except:
return redirect(‘/‘)

 









以上是关于template_showpost的主要内容,如果未能解决你的问题,请参考以下文章

VSCode自定义代码片段——CSS选择器

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器

VSCode自定义代码片段——声明函数