From d5fb589bb5faa30ea56772f49944f81d789c7754 Mon Sep 17 00:00:00 2001 From: xiaji Date: Sun, 25 Jan 2026 21:01:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B1=87=E6=80=BB=E8=AE=B0=E5=BD=95):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B1=87=E6=80=BB=E8=AE=B0=E5=BD=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=8F=8A=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现汇总记录的CRUD功能,包括: - 添加URL路由 - 创建添加、编辑、删除和列表页面 - 在导航栏和首页添加相关链接 - 实现汇总记录的展示和操作功能 --- core/templates/core/add_summary.html | 27 +++++++++++ core/templates/core/base.html | 3 ++ core/templates/core/delete_summary.html | 55 +++++++++++++++++++++++ core/templates/core/edit_summary.html | 27 +++++++++++ core/templates/core/index.html | 27 +++++++++++ core/templates/core/summaries.html | 59 +++++++++++++++++++++++++ core/urls.py | 6 +++ 7 files changed, 204 insertions(+) create mode 100644 core/templates/core/add_summary.html create mode 100644 core/templates/core/delete_summary.html create mode 100644 core/templates/core/edit_summary.html create mode 100644 core/templates/core/summaries.html diff --git a/core/templates/core/add_summary.html b/core/templates/core/add_summary.html new file mode 100644 index 0000000..c7e323c --- /dev/null +++ b/core/templates/core/add_summary.html @@ -0,0 +1,27 @@ +{% extends 'core/base.html' %} + +{% block content %} +

添加汇总记录

+ +
+ {% csrf_token %} + + {% for field in form %} +
+ + {{ field }} + {% if field.help_text %} +
{{ field.help_text }}
+ {% endif %} + {% for error in field.errors %} +
{{ error }}
+ {% endfor %} +
+ {% endfor %} + +
+ + 取消 +
+
+{% endblock %} diff --git a/core/templates/core/base.html b/core/templates/core/base.html index 0d6b793..d29981a 100644 --- a/core/templates/core/base.html +++ b/core/templates/core/base.html @@ -49,6 +49,9 @@ + diff --git a/core/templates/core/delete_summary.html b/core/templates/core/delete_summary.html new file mode 100644 index 0000000..38a361d --- /dev/null +++ b/core/templates/core/delete_summary.html @@ -0,0 +1,55 @@ +{% extends 'core/base.html' %} + +{% block content %} +

删除汇总记录

+ +
+

确定要删除以下汇总记录吗?此操作不可恢复。

+
+ +
+
+
汇总记录详情
+
+
+ + + + + + + + + + + + + + + + + + + + + + {% if summary.file %} + + + + + {% endif %} +
日期{{ summary.date }}
分类{{ summary.category.name }}
发言人{{ summary.speaker.name }}
内容{{ summary.content }}
来源{{ summary.source|default:"-" }}
附件 + {{ summary.file.name }} +
+
+
+ +
+ {% csrf_token %} +
+ + 取消 +
+
+{% endblock %} diff --git a/core/templates/core/edit_summary.html b/core/templates/core/edit_summary.html new file mode 100644 index 0000000..50520bd --- /dev/null +++ b/core/templates/core/edit_summary.html @@ -0,0 +1,27 @@ +{% extends 'core/base.html' %} + +{% block content %} +

编辑汇总记录

+ +
+ {% csrf_token %} + + {% for field in form %} +
+ + {{ field }} + {% if field.help_text %} +
{{ field.help_text }}
+ {% endif %} + {% for error in field.errors %} +
{{ error }}
+ {% endfor %} +
+ {% endfor %} + +
+ + 取消 +
+
+{% endblock %} diff --git a/core/templates/core/index.html b/core/templates/core/index.html index ff41d9b..cf7db91 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -138,6 +138,33 @@ {% endif %} + + +
+
+
汇总记录
+ {% if yesterday_summary %} +
    + {% for summary in yesterday_summary %} +
  • + {{ summary.category.name }} - {{ summary.speaker.name }} +
    {{ summary.content }}
    + {% if summary.source %} + 来源:{{ summary.source }} + {% endif %} + {% if summary.file %} + + {% endif %} +
  • + {% endfor %} +
+ {% else %} +

昨日没有汇总记录

+ {% endif %} +
+
diff --git a/core/templates/core/summaries.html b/core/templates/core/summaries.html new file mode 100644 index 0000000..0fcc746 --- /dev/null +++ b/core/templates/core/summaries.html @@ -0,0 +1,59 @@ +{% extends 'core/base.html' %} + +{% block content %} +

汇总记录 ({{ yesterday }})

+ +
+ 添加汇总记录 +
+ +{% if summary_records %} +
+
+
汇总记录列表
+
+
+ + + + + + + + + + + + {% for summary in summary_records %} + + + + + + + + {% endfor %} + +
分类发言人内容来源操作
{{ summary.category.name }}{{ summary.speaker.name }}{{ summary.content|truncatechars:100 }}{{ summary.source|default:"-" }} + {% if summary.file %} + + + + {% endif %} + + + + + + +
+
+
+{% else %} +
+
+

昨日没有汇总记录,点击上方按钮添加

+
+
+{% endif %} +{% endblock %} diff --git a/core/urls.py b/core/urls.py index 8068c73..745fe09 100644 --- a/core/urls.py +++ b/core/urls.py @@ -23,6 +23,12 @@ urlpatterns = [ path('today/insight//edit/', views.edit_today_insight, name='edit_today_insight'), path('today/insight//delete/', views.delete_today_insight, name='delete_today_insight'), + # 汇总记录 + path('summaries/', views.summaries, name='summaries'), + path('summaries/add/', views.add_summary, name='add_summary'), + path('summaries//edit/', views.edit_summary, name='edit_summary'), + path('summaries//delete/', views.delete_summary, name='delete_summary'), + # 家庭事项 path('family-tasks/', views.family_tasks, name='family_tasks'), path('family-tasks/add/', views.add_family_task, name='add_family_task'),