-
Hi all! Recently while working on some Airflow plugins I find the existing set of I'd like to parametrize this aspect of this widget (such as shown below) so that using it from outside the core Airflow web server is more flexible. Please advise whether this is worth raising an issue about. I am willing to submit a PR if it's worth the effort from the maintainers. Thank you! class FlexibleDateTimePickerWidget(AirflowDateTimePickerWidget):
"""Identical to the parent class, except that the field can be configured
to be required or not at the front end based on the value passed in
at instantiation
"""
def __init__(self, required_at_frontend: bool = True):
self.required_at_frontend = required_at_frontend
def __call__(self, field, **kwargs):
kwargs.setdefault("id", field.id)
kwargs.setdefault("name", field.name)
if not field.data:
field.data = ""
template = self.data_template
return Markup(
template % {
"text": html_params(
type="text", value=field.data, required=self.required_at_frontend, **kwargs
)
}
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No idea if it's that useful or not, but if you find it useful - why not. Does not seem like a big PR, you can just raise it and explain there - there is no need for separate approval/discussion. Worst thing, it's going to be rejected. |
Beta Was this translation helpful? Give feedback.
No idea if it's that useful or not, but if you find it useful - why not. Does not seem like a big PR, you can just raise it and explain there - there is no need for separate approval/discussion. Worst thing, it's going to be rejected.