starting on doing AI with people and refimgs

This commit is contained in:
2021-01-15 15:33:56 +11:00
parent 665096f97d
commit 7cda51c89b
2 changed files with 6 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ from sqlalchemy.exc import SQLAlchemyError
from status import st, Status from status import st, Status
from files import File from files import File
from refimg import Refimg
################################################################################ ################################################################################
# Class describing Person in the database, and via sqlalchemy, connected to the DB as well # Class describing Person in the database, and via sqlalchemy, connected to the DB as well
@@ -88,6 +89,8 @@ def new_person():
def person(id): def person(id):
form = PersonForm(request.form) form = PersonForm(request.form)
page_title='Edit Person' page_title='Edit Person'
reference_imgs = Refimg.query.all()
if request.method == 'POST': if request.method == 'POST':
try: try:
person = Person.query.get(id) person = Person.query.get(id)
@@ -105,8 +108,8 @@ def person(id):
except SQLAlchemyError as e: except SQLAlchemyError as e:
st.SetAlert( "danger" ) st.SetAlert( "danger" )
st.SetMessage( "<b>Failed to modify Person:</b>&nbsp;{}".format(e.orig) ) st.SetMessage( "<b>Failed to modify Person:</b>&nbsp;{}".format(e.orig) )
return render_template("person.html", form=form, page_title=page_title, alert=st.GetAlert(), message=st.GetMessage() ) return render_template("person.html", form=form, reference_imgs="test", page_title=page_title, alert=st.GetAlert(), message=st.GetMessage() )
else: else:
person = Person.query.get(id) person = Person.query.get(id)
form = PersonForm(request.values, obj=person) form = PersonForm(request.values, obj=person)
return render_template("person.html", object=person, form=form, page_title = page_title, alert=st.GetAlert(), message=st.GetMessage() ) return render_template("person.html", object=person, form=form, reference_imgs=reference_imgs, page_title = page_title, alert=st.GetAlert(), message=st.GetMessage() )

View File

@@ -1,6 +1,7 @@
{% extends "base.html" %} {% block main_content %} {% extends "base.html" %} {% block main_content %}
<div class="container"> <div class="container">
<h3 class="offset-lg-2">{{page_title}}</h3> <h3 class="offset-lg-2">{{page_title}}</h3>
{{reference_imgs}}
<div class="row"> <div class="row">
<form class="form form-inline col-xl-12" action="" method="POST"> <form class="form form-inline col-xl-12" action="" method="POST">
{% for field in form %} {% for field in form %}