You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/04/18 16:20:00 UTC
[GitHub] [incubator-superset] dpgaspar commented on a change in pull request
#7326: [annotations] Improves annotation validation, start_dttm, end_dttm
dpgaspar commented on a change in pull request #7326: [annotations] Improves annotation validation, start_dttm, end_dttm
URL: https://github.com/apache/incubator-superset/pull/7326#discussion_r276736364
##########
File path: superset/views/annotations.py
##########
@@ -18,12 +18,30 @@
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_babel import gettext as __
from flask_babel import lazy_gettext as _
+from wtforms.validators import StopValidation
from superset import appbuilder
from superset.models.annotations import Annotation, AnnotationLayer
from .base import DeleteMixin, SupersetModelView
+class StartEndDttmValidator(object):
+ """
+ Validates dttm fields.
+ """
+ def __call__(self, form, field):
+ if not form['start_dttm'].data and not form['end_dttm'].data:
+ raise StopValidation(
+ _('annotation start time or end time is required.'),
Review comment:
The final user message is: "Not a valid datetime value annotation start time or end time is required."
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org