WTForm extensions for form templates and useful functions.
Click a link to jump to the indicated section.
class
bluecat.wtform_extensions.GatewayForm
(*args, **kwargs)
Bases: flask_wtf.form.FlaskForm
Custom Form for generating DNS Gateway Workflows.
javascript_generator(element_id='')
Generates JavaScript for re-enabling disabled fields upon reloading the same workflow with an error.
Returns: HTML script snippet with generated JavaScript.
class
bluecat.wtform_extensions.NoPreValidationSelectField
(*args, **kwargs)
Bases: wtforms.fields.choices.SelectField
SelectField with no pre-validation of field value against possible choices. Useful if choices are dynamically populated.
pre_validate(form)
Pre-validate method being overwritten to no longer perform validation.
bluecat.wtform_extensions.validate_element_in_tuple
(index_of_value_to_validate, validator)
Use when you have a field such as a SelectField that has a choices attribute with a list of tuples. If you have an element in the tuple that needs to be validated but it is not the first element of the tuple.
Parameters | Description |
---|---|
index_of_value_to_validate |
The index of the element in the tuple that should be validated. Only the element with the specified index in the tuple will be validated. |
validator |
The validator function to use when validating the value at the given index of the tuple. |