Esempio n. 1
0
def get_tool_full_config_history(tool: Tool):
    # tool config by user and tool and time
    configs = []
    config_history = ConfigurationHistory.objects.filter(
        configuration__tool_id=tool.id).order_by("-modification_time")[:20]
    configurations = tool.current_ordered_configurations()
    for c in config_history:
        for co in configurations:
            if co == c.configuration:
                current_settings = co.current_settings_as_list()
                current_settings[c.slot] = c.setting
                co.current_settings = ", ".join(current_settings)
        config_input = {
            "configurations": configurations,
            "render_as_form": False
        }
        configuration = ConfigurationEditor()
        configs.append({
            "modification_time": c.modification_time,
            "user": c.user,
            "html": configuration.render(None, config_input)
        })
    return configs
Esempio n. 2
0
def get_tool_full_config_history(tool: Tool):
    # tool config by user and tool and time
    configs = []
    config_history = ConfigurationHistory.objects.filter(
        configuration__tool_id=tool.id).order_by('-modification_time')[:20]
    configurations = tool.current_ordered_configurations()
    for c in config_history:
        for co in configurations:
            if co == c.configuration:
                current_settings = co.current_settings_as_list()
                current_settings[c.slot] = c.setting
                co.current_settings = ', '.join(current_settings)
        config_input = {
            'configurations': configurations,
            'render_as_form': False,
        }
        configuration = ConfigurationEditor()
        configs.append({
            'modification_time': c.modification_time,
            'user': c.user,
            'html': configuration.render(None, config_input),
        })
    return configs