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:
@@ -36,7 +36,7 @@ class PublisherForm(FlaskForm):
|
||||
@app.route("/publishers", methods=["GET"])
|
||||
def publishers():
|
||||
publishers = Publisher.query.all()
|
||||
return render_template("publishers.html", publishers=publishers)
|
||||
return render_template("show_id_name.html", objects=publishers, page_title='Show All Publishers', url_base='publisher')
|
||||
|
||||
################################################################################
|
||||
# /publisher/<id> -> GET/POST(save or delete) -> shows/edits/delets a single publisher
|
||||
@@ -62,4 +62,4 @@ def publisher(id):
|
||||
publisher = Publisher.query.get(id)
|
||||
publisher_form = PublisherForm(request.values, obj=publisher)
|
||||
message=""
|
||||
return render_template("id_name_form.html", publisher=publisher, alert=alert, message=message, form=publisher_form, page_title='Edit Publisher')
|
||||
return render_template("edit_id_name.html", publisher=publisher, alert=alert, message=message, form=publisher_form, page_title='Edit Publisher')
|
||||
|
||||
Reference in New Issue
Block a user