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