WEB/Django prac

[Django prac][ORM with View] CRUD 구현 5

bay07 2024. 3. 27. 16:43

단일 게시글 페이지 링크 작성 

# articles > templates > articles > index.html 

 

 

 

더보기
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h1>Articles</h1>
  <hr>
  {% for article in articles %}
    <p>글 번호: {{ article.pk }}</p>
    <a href="{% url "articles:detail" article.pk %}">
      <p>글 제목: {{ article.title }}</p>
    </a>
    <p>글 내용: {{ article.content }}</p>
    <hr>
  {% endfor %}
</body>
</html>

페이지 열어서 확인하기 

python manage.py runserver