從首頁問答標題到問答詳情頁

    1. 主PY文件寫視圖函數,帶id參數。 
      @app.route('/detail/<question_id>')
      def detail(question_id):
          quest = 
          return render_template('detail.html', ques = quest)
    2. 首頁標題的標籤作帶參數的連接。
            {{ url_for('detail',question_id = foo.id) }}

    3. 在詳情頁將數據的顯示在恰當的位置。 
      {{ ques.title}}
      {{ ques.id  }}{{  ques.creat_time }}
      {{ ques.author.username }} 
      {{ ques.detail }}
    4. 創建評論的對象關係映射:html

      class Comment(db.Model):
          __tablename__='comment'app

    5.  嘗試實現發佈評論函數

相關文章
相關標籤/搜索