urls.py
views.py
list.html
urls.py
<int:num> 선언한 이유는 뒤에서 설명하겠다.
views.py
view_detail.html
하고 list.html 코드를 수정해야한다.
num변수를 int형, 정수형으로 계속 받아온다. 그 다음 URL을 명시한
<a>
태그안을 보면"/view_detail/{{ article.id }}">{{article.id}}</a>
을 들여다 보자. 태그 a가 article.id 변수를 감싸고 있으므로 id가 URL이 되고 id를 클릭하면이와 같이
vie_detail/
다음id
값으로 주소를 호출한다. 이 원리로 처음에int:num
을 선언하였다.
views.py
urls.py
lastest_article_list
을 in
다음으로 받아 변수를 선언하자.메모작성하기
버튼을 추가하여 write.html경로에 연결하고 bootstrap에서 버튼모양과 색을 설정하자.<button type="button" class="btn btn-success">
<a href="/community/write">메모작성하기</a></button>
작성 버튼을 누르면 write.html로 이동하고,
하이퍼 링크를 누르면 view_detail.html로 이동한다.
list, view_detail, write html파일들을 templates\community로 이동, index.html은 이동X
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
index의 행이름과 열변수들을 bootstrap 구조에 알맞게 입력하자.
이런 화면이 나오게된다.
ctrl+shift+p -> Wrap with Abbreviation -> div.container를 입력하면
div class="container"
로 감싸게 되어 반응형 컨테이너를 추가해주면 된다.