From 200810d793b2d8ec409265388816eaf6c656695c Mon Sep 17 00:00:00 2001 From: candifloss Date: Fri, 7 Feb 2025 23:50:26 +0530 Subject: [PATCH] Fixed create.py and update.html --- routes/create.py | 6 +++--- templates/update.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/routes/create.py b/routes/create.py index b5cc360..42f2df2 100644 --- a/routes/create.py +++ b/routes/create.py @@ -17,7 +17,7 @@ def create(): try: primary_attr = next((attrib_name for attrib_name, attrib in item_attributes.items() if attrib.primary), None) except ValueError: - return render_template('create.html', exc=primary_attr) + return render_template('create.html', item_attributes=item_attributes, exc=primary_attr) item = Asset(**form_data) @@ -25,8 +25,8 @@ def create(): db.session.add(item) db.session.commit() except exc.IntegrityError: - return render_template('create.html', exc='integrity') + return render_template('create.html', item_attributes=item_attributes, exc='integrity') except exc.StatementError: - return render_template('create.html', exc='status') + return render_template('create.html', item_attributes=item_attributes, exc='status') return redirect('/viewall') \ No newline at end of file diff --git a/templates/update.html b/templates/update.html index c00e6ec..f8ec41c 100644 --- a/templates/update.html +++ b/templates/update.html @@ -18,7 +18,7 @@ {%- if properties.required %} required {% endif -%} > {% for option in properties.options -%} - + {% endfor -%} {% else %} @@ -29,7 +29,7 @@ {%- 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 -%} - {%- if item.attrib %} value="{{ item.attrib }}" {% endif -%} + {%- if item[attrib] %} value="{{ item[attrib] }}" {% endif -%} /> {% endif -%}