Update web/core/forms.py
This commit is contained in:
parent
37edcf92e6
commit
44ace418c7
@ -1,6 +1,7 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from .models_ann import Announcement
|
from .models_ann import Announcement
|
||||||
from django.forms import ModelForm, Textarea
|
from django.forms import ModelForm, Textarea
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
class ImportForm(forms.Form):
|
class ImportForm(forms.Form):
|
||||||
@ -67,4 +68,8 @@ class AnnouncementForm(ModelForm):
|
|||||||
fields = ["title", "message", "is_active", "start_at", "end_at"]
|
fields = ["title", "message", "is_active", "start_at", "end_at"]
|
||||||
widgets = {
|
widgets = {
|
||||||
"message": Textarea(attrs={"rows": 6, "placeholder": "What’s new in this release…"}),
|
"message": Textarea(attrs={"rows": 6, "placeholder": "What’s new in this release…"}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def clean_start_at(self):
|
||||||
|
v = self.cleaned_data.get("start_at")
|
||||||
|
return v or timezone.now()
|
||||||
Loading…
Reference in New Issue
Block a user