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:
@@ -37,7 +37,7 @@ class ConditionForm(FlaskForm):
|
||||
@app.route("/conditions", methods=["GET"])
|
||||
def conditions():
|
||||
conditions = Condition.query.order_by('id').all()
|
||||
return render_template("conditions.html", conditions=conditions)
|
||||
return render_template("show_id_name.html", objects=conditions, page_title='Show All Conditions', url_base='condition')
|
||||
|
||||
################################################################################
|
||||
# /condition/<id> -> GET/POST(save or delete) -> shows/edits/delets a single
|
||||
@@ -64,4 +64,4 @@ def condition(id):
|
||||
condition = Condition.query.get(id)
|
||||
condition_form = ConditionForm(request.values, obj=condition)
|
||||
message=""
|
||||
return render_template("id_name_form.html", condition=condition, alert=alert, message=message, form=condition_form, page_title='Edit Condition')
|
||||
return render_template("edit_id_name.html", condition=condition, alert=alert, message=message, form=condition_form, page_title='Edit Condition')
|
||||
|
||||
Reference in New Issue
Block a user