def is_required_form_field(field):
 for validator in field.validators:
  if isinstance(validator, (DataRequired, InputRequired)):
   return True
 return False

def is_required_form_field ( field ) : for validator in field . validators : if isinstance ( validator , ( DataRequired , InputRequired ) ) : return True return False
check if form field has datarequired or inputrequired validators .