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