|
@@ -1,12 +1,12 @@
|
|
|
import logging
|
|
|
from datetime import datetime
|
|
|
|
|
|
-from flask_wtf import Form
|
|
|
from pytimeparse.timeparse import timeparse
|
|
|
-from wtforms import (SelectMultipleField, StringField, SubmitField,
|
|
|
- ValidationError, validators)
|
|
|
|
|
|
+from flask_wtf import Form
|
|
|
from larigira.formutils import EasyDateTimeField
|
|
|
+from wtforms import (SelectMultipleField, StringField, SubmitField,
|
|
|
+ ValidationError, validators)
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
@@ -84,9 +84,9 @@ class FrequencyAlarmForm(Form):
|
|
|
def populate_from_timespec(self, timespec):
|
|
|
if "nick" in timespec:
|
|
|
self.nick.data = timespec["nick"]
|
|
|
- if "start" in timespec:
|
|
|
+ if timespec.get("start"):
|
|
|
self.start.data = datetime.fromtimestamp(timespec["start"])
|
|
|
- if "end" in timespec:
|
|
|
+ if timespec.get("end"):
|
|
|
self.end.data = datetime.fromtimestamp(timespec["end"])
|
|
|
if "weekdays" in timespec:
|
|
|
self.weekdays.data = timespec["weekdays"]
|