Update web/core/forms.py

This commit is contained in:
Joshua Laymon 2025-08-30 03:17:44 +00:00
parent 37edcf92e6
commit 44ace418c7

View File

@ -1,6 +1,7 @@
from django import forms
from .models_ann import Announcement
from django.forms import ModelForm, Textarea
from django.utils import timezone
class ImportForm(forms.Form):
@ -67,4 +68,8 @@ class AnnouncementForm(ModelForm):
fields = ["title", "message", "is_active", "start_at", "end_at"]
widgets = {
"message": Textarea(attrs={"rows": 6, "placeholder": "Whats new in this release…"}),
}
}
def clean_start_at(self):
v = self.cleaned_data.get("start_at")
return v or timezone.now()