bmc_hub/patch_hw_help.py

11 lines
565 B
Python
Raw Permalink Normal View History

with open("app/modules/hardware/templates/detail.html", "r") as f:
content = f.read()
target = ' <a href="/hardware/{{ hardware.id }}/edit" class="btn btn-sm btn-outline-primary" style="opacity: 0.8;">'
replacement = ' <button onclick="openManualHelp(\'Hardware\')" class="btn btn-sm btn-outline-info" title="Hjælp til Hardware"><i class="bi bi-question-lg"></i></button>\n' + target
content = content.replace(target, replacement)
with open("app/modules/hardware/templates/detail.html", "w") as f:
f.write(content)