zoukankan      html  css  js  c++  java
  • 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('/')
  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
  • 原文地址:https://www.cnblogs.com/exploer/p/9763229.html
Copyright © 2011-2022 走看看