摘要: 排序,我们需要在前端传递参数, 编辑front_index.html 编辑front.views.py from apps.models import HighlightPostModel from sqlalchemy.sql import func ... @bp.route('/') def 阅读全文
posted @ 2018-10-07 23:24 sellsa 阅读(1180) 评论(0) 推荐(0) 编辑
摘要: 帖子加精和取消加精是在cms后台来设置的 后台逻辑 首页个帖子加精设计个模型表,编辑apps.models.py 同步表到数据库 视图函数,编辑cms.views.py from apps.models import HighlightPostModel, PostModel ... @bp.rou 阅读全文
posted @ 2018-10-07 22:37 sellsa 阅读(563) 评论(0) 推荐(0) 编辑
摘要: 评论后端逻辑实现 设计评论模型表, 编辑apps.models.py 同步表到数据库 后端需要对评论进行表单验证,编辑front.forms.py 写视图函数,编辑front.views.py 评论前端布局 <div class="lg-container"> ... <div class="com 阅读全文
posted @ 2018-10-07 18:26 sellsa 阅读(819) 评论(0) 推荐(0) 编辑
摘要: 在templates/front/下创建详情页面front_pdetail.html 编辑front.views.py创建详情页的视图函数 上面写了,如果帖子不存在,则返回404,我们先创建个404页面 <!DOCTYPE html> <html lang="en"> <head> <meta ch 阅读全文
posted @ 2018-10-07 18:01 sellsa 阅读(932) 评论(0) 推荐(0) 编辑
摘要: 先在显示的帖子是所有版块的帖子,这节我们来完成点击某个版块,则显示此版块的帖子 要完成这个功能,我们需要在前端传递板块的id到后台, 编辑front_index.html 编辑首页视图 编辑板块选中样式 阅读全文
posted @ 2018-10-07 16:41 sellsa 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 编辑manage.py,添加测试帖子 运行 在 flask框架中,我们可以使用Flask Paginate插件来实现分页 https://pythonhosted.org/Flask-paginate/ 安装插件 编辑配config.py,配置每页显示的帖子数 编辑首页的视图函数,编辑front.v 阅读全文
posted @ 2018-10-07 15:54 sellsa 阅读(1034) 评论(0) 推荐(0) 编辑