flask_crud_app/templates/update.html

52 lines
1.8 KiB
HTML
Raw Normal View History

2025-01-29 05:27:19 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Update Item</title>
</head>
<body>
<h2 align="center">Update Item</h2>
<form action='' method = "POST">
2025-02-06 10:43:09 +00:00
{% for attrib, properties in item_attributes.items() -%}
2025-01-29 05:27:19 +00:00
<p>
2025-02-06 10:43:09 +00:00
<label for="{{ attrib }}">{{ properties.display_name }}:</label>
{%- if properties.html_input_type == "select" %}
<select
id="{{ attrib }}"
name="{{ attrib }}"
{%- if properties.required %} required {% endif -%}
>
{% for option in properties.options -%}
2025-02-07 18:20:26 +00:00
<option value="{{ option }}" {% if item[attrib] == option %}selected{% endif %}>{{ option }}</option>
2025-02-06 10:43:09 +00:00
{% endfor -%}
</select>
{% else %}
<input
id="{{ attrib }}"
type="{{ properties.html_input_type }}"
name="{{ attrib }}"
{%- if properties.required %} required {% endif -%}
{%- if properties.min is not none %} min="{{ properties.min }}" {% endif -%}
{%- if properties.max is not none %} max="{{ properties.max }}" {% endif -%}
2025-02-07 18:20:26 +00:00
{%- if item[attrib] %} value="{{ item[attrib] }}" {% endif -%}
2025-02-06 10:43:09 +00:00
/>
{% endif -%}
2025-01-29 05:27:19 +00:00
</p>
2025-02-06 10:43:09 +00:00
{% endfor %}
2025-02-06 10:06:46 +00:00
<p><input type = "submit" value = "Update" /></p>
2025-01-29 05:27:19 +00:00
</form>
<p align="center">
2025-02-06 10:06:46 +00:00
{%- if exc == 'integrity' -%}
Item with the same assettag already exists
{%- endif -%}
{%- if exc == 'status' -%}
Data input error. Invalid status value
{%- endif -%}
{%- if exc == 'staffnum' -%}
2025-01-29 10:05:36 +00:00
Data input error. Staff number must be an integer
2025-02-06 10:06:46 +00:00
{%- endif -%}
2025-01-29 05:27:19 +00:00
</p>
</body>
</html>