29.帖子详情页布局

(1)front/hooks.py

@bp.errorhandler
def page_not_found():
return render_template('front/front_404.html'),404

(2)front/front_404.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body> <p>您要找的页面飞到火星去了!!!!!</p>
<a href="/">回到首页</a> </body>
</html>

(3)front/views.py

@bp.route('/p/<post_id>')
def post_detail(post_id):
print(post_id)
post=PostModel.query.get(post_id)
if not post:
abort(404)
return render_template('front/front_postdetail.html',post=post)

(4)front_index.html

 <p class="post-title"><a href="{{ url_for('front.post_detail',post_id=post.id) }}">{{ post.title }}</a></p>

(5)front_postdetail.html

{% extends 'front/front_base.html' %}
{% from 'common/_macros.html' import static %} {% block title %}
{{ post.title }}
{% endblock %} {% block head %} <link rel="stylesheet" href="{{ static('front/css/front_pdetail.css') }}">
{% endblock %} {% block body %}
<div class="lg-container">
<div class="post-container">
<h2>{{ post.title }}</h2>
<p class="post-info-group">
<span>发表时间:{{ post.create_time }}</span>
<span>作者:{{ post.author.username }}</span>
<span>版块:{{ post.board.name }}</span>
<span>阅读数:{{ post.read_count }}</span>
<span>评论数:0</span>
</p>
<article class="post-content" id="post-content" data-id="{{ post.id }}">
{{ post.content|safe }}
</article>
</div>
</div> <div class="sm-container"></div> {% endblock %}

(6)front/css/front_pdetail.css

*{
margin:;
padding:0
}
.post-container{
border:1px solid #e6e6e6;
padding: 10px;
}
.post-info-group{
font-size: 12px;
color: #8c8c8c;
border-bottom:1px solid #e6e6e6;
margin-top: 20px;
padding-bottom: 10px; }
.post-info-group span{
margin-right: 20px;
}
.post-content{
margin-top: 20px;
}
.post-content img{
max-width:100%;
}

最新文章

  1. https
  2. solr连接数据库配置
  3. hadoop fs -mkdir testdata错误 提示No such file or directory
  4. codeforces 278Div1 B题
  5. 高性能Socket组件和RPC,让你像写本地代码一样开发网络应用和分布式程序
  6. Session为空的一种原因
  7. ubuntu16.04 开发环境搭建
  8. objective-c中@autoreleasepool的用法
  9. Tornado day1
  10. Python视频人脸检测识别
  11. centos7配置网易yum源
  12. laravel 分类的列表查询
  13. 笔记 oracle 创建联合主键
  14. 空指针null
  15. css实战第三天小结
  16. docker部署jenkinsci blueocean
  17. Docker K8s基本概念入门
  18. redis 的set数据类型
  19. [Windows][C#][.NET][WPF]基于ArcFace2.0+红外双目摄像头的活体检测
  20. 87. 再谈变体型Variant

热门文章

  1. 563. Binary Tree Tilt
  2. 部署Mvc Core SSL网站到Centos并用Nginx作为反向代理
  3. jdk1.7更新visualvm插件
  4. 课下必做MyCP
  5. SVM 实践步骤
  6. SVM原理 (转载)
  7. 我们为什么不用 Select * 吗?
  8. 怎样使用C# MD5加密来增强密码的安全度
  9. (转)Jquery获取上级、下级或者同级的元素
  10. 支持不同Android设备,包括:不同尺寸屏幕、不同屏幕密度、不同系统设置