docs: 添加日历功能警告注释(防止误删)

This commit is contained in:
maoshen
2026-04-15 02:16:19 +00:00
parent e91b58b079
commit c8178ce98f
2 changed files with 41 additions and 3 deletions

View File

@@ -2,7 +2,20 @@ from django.db import models
from django.utils import timezone
class DiaryEntry(models.Model):
"""日记条目 - 作为所有记录的主入口"""
"""
⚠️ 核心模型:日记条目
与日历组件关联 - 修改此模型会影响日历功能
日历功能依赖:
- date 字段(唯一)- 用于日历标记
- linked_tasks - 关联任务
- extract_experience() - 提炼经验
修改前必须:
1. 阅读 docs/CALENDAR.md
2. 确认不影响日历显示
3. 运行 test_frontend.py diary 验证
"""
date = models.DateField('日期', unique=True)
title = models.CharField('标题', max_length=200, default='每日日记')
content = models.TextField('日记内容', blank=True, default='')
@@ -47,7 +60,16 @@ class DiaryEntry(models.Model):
class Experience(models.Model):
"""经验总结 - 记录遇到的问题和解决方法"""
"""
⚠️ 核心模型:经验总结
从日记提炼的经验教训
关联:
- extracted_from - 可选,关联到日记
- category - 分类显示
修改前阅读 docs/EXPERIENCE.md
"""
title = models.CharField('标题', max_length=200)
category = models.CharField('类别', max_length=50, choices=[
('deployment', '📦 部署'),

View File

@@ -4,6 +4,19 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>码神的日记系统</title>
<!--
⚠️⚠️⚠️ 核心功能:日历组件 ⚠️⚠️⚠️
修改此文件前必须:
1. 阅读 docs/CALENDAR.md 了解日历功能
2. 确认不会删除日历相关代码
3. 修改后运行 test_frontend.py diary 验证
日历功能包括:
- 月历视图显示
- 点击日期显示日记
- 上月/下月切换
- 有日记的日期标记 📝
-->
<style>
* {
margin: 0;
@@ -102,7 +115,7 @@
border-bottom: 2px solid #667eea;
}
/* 日历组件 */
/* ⚠️ 日历组件样式 - 核心功能,不可删除 */
.calendar-wrapper {
display: flex;
gap: 20px;
@@ -596,6 +609,7 @@
return state.allEntries.find(entry => entry.date === date);
}
// ⚠️ 核心功能:渲染日历 - 不可删除
function renderCalendar(year, month, selectedDate, hasDataDates) {
const firstDay = new Date(year, month, 1);
const lastDay = new Date(year, month + 1, 0);
@@ -896,6 +910,7 @@
render();
}
// ⚠️ 核心功能:选择日期显示日记 - 不可删除
function selectDate(date) {
state.selectedDate = date;
render();
@@ -906,6 +921,7 @@
render();
}
// ⚠️ 核心功能:切换月份 - 不可删除
function changeMonth(delta) {
if (!state.currentCalendar) {
state.currentCalendar = new Date();