@staticmethod
    def display_input(input_type, key, required, values, default_value, saved_value):
        current_input = '<input type="{type}" ' \
                        'class="{input_class}" ' \
                        'name="{name}"' \
                        '{required}' \
                        '{checked} ' \
                        'value="{value}" ' \
                        'id="{id}">'
        if input_type == "string":
            current_input = current_input.format(id=key,
                                                 type="text",
                                                 input_class="form-control",
                                                 name=key,
                                                 required=" required" if required else "",
                                                 checked="",
                                                 value=saved_value if saved_value is not None
                                                 else default_value if default_value is not None
                                                 else "")
        elif input_type == "boolean":
            # Hack for posting checkbox even if it's unchecked. Hidden input value will be used in case of
            # the checkbox is unchecked

            hidden_input = '<input type="hidden" ' \
                           'name="{name}"' \
                           'value="{value}">'.format(name=key,
                                                     value="False")

            current_input = hidden_input + current_input.format(id=key,
                                                                type="checkbox",
                                                                input_class="",
                                                                name=key,
                                                                required="",
                                                                checked=" checked" if saved_value is not None and saved_value
                                                                else "" if saved_value is not None and not saved_value
                                                                else " checked" if default_value
                                                                else "",
                                                                value="True")
        elif input_type == "integer":
            current_input = current_input.format(id=key,
                                                 type="number",
                                                 input_class="form-control",
                                                 name=key,
                                                 required=" required" if required else "",
                                                 checked="",
                                                 value=saved_value if saved_value is not None
                                                 else default_value if default_value is not None
                                                 else "")
        elif input_type == "list":
            select = ['<select class="form-control" name="{name}"{required} id="{id}">'.format(name=key,
                                                                                               required=" required"
                                                                                               if required
                                                                                               else "",
                                                                                               id=key)]
            for value in values:
                select.append('<option value="{value}"{selected}>'.format(value=value['value'],
                                                                          selected=" selected"
                                                                          if saved_value == value['value']
                                                                          else ""))

                select.append(value['title'])
                select.append("</option>")
            select.append('</select>')
            current_input = "\n".join(select)
        return current_input
Creates HTML input, depending of the entry type
dataset/ETHPy150Open OpenMDM/OpenMDM/public_gate/models.py/RecipeForm.display_input