xinhua_base
This commit is contained in:
17
core/templates/core/article_detail.html
Normal file
17
core/templates/core/article_detail.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{{ article.title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{ article.title }}</h1>
|
||||
<p>发布时间: {{ article.pub_date|date:"Y-m-d H:i" }}</p>
|
||||
<hr />
|
||||
<div>
|
||||
{{ article.content|safe }}
|
||||
</div>
|
||||
<hr />
|
||||
<p><a href="{% url 'article_list' %}">返回列表</a></p>
|
||||
</body>
|
||||
</html>
|
||||
33
core/templates/core/article_list.html
Normal file
33
core/templates/core/article_list.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>绿色课堂文章列表</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>绿色课堂文章列表</h1>
|
||||
|
||||
<ul>
|
||||
{% for article in page_obj %}
|
||||
<li>
|
||||
<a href="{% url 'article_detail' article.id %}">{{ article.title }}</a>
|
||||
({{ article.created_at|date:"Y-m-d" }})
|
||||
</li>
|
||||
{% empty %}
|
||||
<li>暂无文章</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<div class="pagination">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page={{ page_obj.previous_page_number }}">上一页</a>
|
||||
{% endif %}
|
||||
|
||||
<span>第 {{ page_obj.number }} 页,共 {{ page_obj.paginator.num_pages }} 页</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}">下一页</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user