{ board }

  • 장고 - 게시판 댓글 기능 적용

    |

    ex) 게시판 프로젝트(board_project)

    1. 특정 페이지에서 댓글 템플릿 연동

    • 댓글 목록의 template 따로 생성 (댓글 부분 페이지네이션 필요하기 때문)
    • 경로 : templates > board > comment_list.html
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      <table class="table table-striped">
      <thead>
      <tr>
      <th colspan="3" class="align-left">댓글 목록</th>
      </tr>
      </thead>
      {% for comment in comments %}
      <tr>
      <td>{{comment.text}}</td>
      <td>{{comment.author.username}}</td>
      <td>{{comment.created}}</td>
      </tr>
      {% endfor %}
      </table>