xinhua_base

This commit is contained in:
2025-08-11 13:10:23 +08:00
parent b43443551f
commit 4e5e35b4fa
20 changed files with 427 additions and 1 deletions

View 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>

View 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>