renamed id_name_form to edit_id_name, then made show_id_name and used it for all appropriate classes. Shaved about 150 LOC / removed 5 x duplication of code :)

This commit is contained in:
2020-11-18 12:30:23 +11:00
parent 3f33e7f10d
commit 296ef4c1f7
14 changed files with 17 additions and 91 deletions

View File

@@ -37,7 +37,7 @@ class OwnedForm(FlaskForm):
@app.route("/owneds", methods=["GET"])
def owneds():
owneds = Owned.query.order_by('id').all()
return render_template("owneds.html", owneds=owneds)
return render_template("show_id_name.html", objects=owneds, page_title='Show All Ownership types', url_base='owned')
################################################################################
# /owned/<id> -> GET/POST(save or delete) -> shows/edits/delets a single
@@ -64,4 +64,4 @@ def owned(id):
owned = Owned.query.get(id)
owned_form = OwnedForm(request.values, obj=owned)
message=""
return render_template("id_name_form.html", owned=owned, alert=alert, message=message, form=owned_form, page_title='Edit Owned Type' )
return render_template("edit_id_name.html", owned=owned, alert=alert, message=message, form=owned_form, page_title='Edit Owned Type' )