标签:name port c99 ret http end obj turn 使用
使用<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(‘/‘)
标签:name port c99 ret http end obj turn 使用
原文地址:https://www.cnblogs.com/exploer/p/9763229.html