Flask实战2问答平台-问答详情完成

首页文章已经布局完成,这次要完成的功能是点击文章,跳转到文章详情页.
新建detail.html

{% extends 'base.html' %}
{% block title %}详情{% endblock %}
{% block head %}<link rel="stylesheet" href="{{url_for('static',filename = 'css/detail.css')}}"> 
{% endblock %}
{% block main %}
    <div class="container">
    <h3 class="page-title">{{question.title}}</h3>
    <p class="question-info">
        <span>{{question.author.username}}</span>
        <span>{{question.create_time}}</span>
    </p>
    <hr>
    <p class="question-content">{{question.content}}</p>
    <hr>
    <h4>评论:(0)</h4>
    <form action="#" method="post">
        <div class="form-group">
        <input name="answer_content" type="text" class="form-control" placeholder="请填写评论">

        </div>
        <div class="form-group" >
            <button class="btn btn-primary">立即评论</button>
        </div>
    </form>
</div>
{% endblock %}

detail.css

.question-info{
    text-align: center;
    margin-top: 20px;
}
.container{
    margin: 0;
    width: auto;
}
.form-group{
    text-align: right;
}

然后我们在index.html中添加跳转链接,这样就实现从图一跳转到图二

<p class="question-title"><a href="{{url_for('detail',question_id = question.id)}}">{{question.title}}</a></p>

这里写图片描述

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值