From bdd9b5a6c98d8575f09894bf4add50bb7667b6dc Mon Sep 17 00:00:00 2001 From: xiaji Date: Mon, 5 Jan 2026 19:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=80=E6=9C=89html?= =?UTF-8?q?=E7=9A=84=E8=A1=A8=E5=8D=95=EF=BC=8C=E5=8E=BB=E6=8E=89=E6=97=A5?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/forms.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/core/forms.py b/core/forms.py index f150251..a042a89 100644 --- a/core/forms.py +++ b/core/forms.py @@ -10,16 +10,10 @@ from .models import ( class ReadingRecordForm(forms.ModelForm): """阅读记录表单""" - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # 设置日期字段默认值为当日 - self.fields['date'].initial = timezone.now().date() - class Meta: model = ReadingRecord - fields = ['date', 'type', 'title', 'source', 'progress', 'file'] + fields = ['type', 'title', 'source', 'progress', 'file'] widgets = { - 'date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control', 'readonly': 'readonly'}), 'type': forms.Select(attrs={'class': 'form-select'}), 'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': '请输入标题'}), 'source': forms.TextInput(attrs={'class': 'form-control', 'placeholder': '请输入来源'}), @@ -29,16 +23,10 @@ class ReadingRecordForm(forms.ModelForm): class InsightRecordForm(forms.ModelForm): """感悟记录表单""" - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # 设置日期字段默认值为当日 - self.fields['date'].initial = timezone.now().date() - class Meta: model = InsightRecord - fields = ['date', 'content', 'file'] + fields = ['content', 'file'] widgets = { - 'date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control', 'readonly': 'readonly'}), 'content': forms.Textarea(attrs={'class': 'form-control', 'rows': 5, 'placeholder': '请输入今日感悟'}), 'file': forms.FileInput(attrs={'class': 'form-control'}), }