使用<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的更多相关文章

随机推荐

  1. 记一次nor flash固件烧录速度优化

    背景 某个方案使用的是spinor作为存储介质,每次烧录新固件都耗时数分钟,为了提高效率,需要对其进行优化. 分析流程 基本流程 当前烧录流程,有一个可选步骤,全盘擦除,这个步骤耗时达数分钟.不过这是 ...

  2. 对tf.nn.softmax的理解

    对tf.nn.softmax的理解 转载自律者自由 最后发布于2018-10-31 16:39:40 阅读数 25096  收藏 展开 Softmax的含义:Softmax简单的说就是把一个N*1的向 ...

  3. Mol. Cell. Proteomics | 癌细胞衍生的小细胞外囊体通过促进HGF-Met途径促进受体细胞转移

    题目:Cancer cell derived small extracellular vesicles contribute to recipient cell metastasis through ...

  4. The instance of entity type 'manager' cannot be tracked because another instance with the same key value for {'id'} is already being tracked. When attaching existing entities, ensure that only one ent

    最近在用ASP.NET CORE时遇到一些问题,现记录下: 出现上述错误,即在更新实体数据时出现的错误 services.AddDbContext<StoreContext>(c => ...

  5. 嘉泽 P2120: 【基础】半质数 题解

    原题链接 简要题意: 求区间内能分解为两个质数乘积的数. 欧拉筛先筛素数. 然后再筛答案. 时间复杂度: \(O(n)\). 实际得分:\(100pts\). #pragma GCC optimize ...

  6. CF1326A Bad Ugly Numbers 题解

    原题链接 简要题意: 构造一个长为 \(n\) 的数,使得每位均不为 \(0\),且 \(n\) 不被它的各位数字整除. 比方说, \(n = 239\) 是合法的.因为: \(2 \not | 23 ...

  7. ElasticSearch 32766 的限制

    插入一个稍大的数据到elasticsearch的时候,突然报错“ 400 - elastic: Error 400 (Bad Request): Document contains at least ...

  8. 大规模机器学习(Large Scale Machine Learning)

    本博客是针对Andrew Ng在Coursera上的machine learning课程的学习笔记. 目录 在大数据集上进行学习(Learning with Large Data Sets) 随机梯度 ...

  9. Building Applications with Force.com and VisualForce (DEV401) (二十):Visualforce Pages: Visualforce Componets (Tags)

    Dev401-021:Visualforce Pages: Visualforce Componets (Tags) Module Agenda1.Tag Basics2.Tag Bindings T ...

  10. effective-java学习笔记---注解优于命名模式39

    命名模式的缺点有以下三点:(在第 4 版之前,JUnit 测试框架要求其用户通过以 test[Beck04] 开始名称来指定测试方法) 1.拼写错误导致失败,但不会提示. 2.无法确保它们仅用于适当的 ...