Commit b0a34063 authored by Willard's avatar Willard

Rename 'stall' endpoint to 'view_stall'

parent d8c36fcd
...@@ -22,7 +22,7 @@ def new_dish(stall_id): ...@@ -22,7 +22,7 @@ def new_dish(stall_id):
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
db.session.add(dish) db.session.add(dish)
db.session.commit() db.session.commit()
return redirect(url_for('stall', stall_id=stall.id)) return redirect(url_for('view_stall', stall_id=stall.id))
else: else:
flash_form_errors(form) flash_form_errors(form)
return redirect(url_for('new_dish', stall_id=stall.id)) return redirect(url_for('new_dish', stall_id=stall.id))
...@@ -45,7 +45,7 @@ def edit_dish(stall_id, dish_id): ...@@ -45,7 +45,7 @@ def edit_dish(stall_id, dish_id):
dish.image_path = secure_filename(form.image.data.filename) dish.image_path = secure_filename(form.image.data.filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path)) form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path))
db.session.commit() db.session.commit()
return redirect(url_for('stall', stall_id=stall_id)) return redirect(url_for('view_stall', stall_id=stall_id))
else: else:
flash_form_errors(form) flash_form_errors(form)
return redirect(url_for('edit_dish', stall_id=stall_id, dish_id=dish_id)) return redirect(url_for('edit_dish', stall_id=stall_id, dish_id=dish_id))
...@@ -64,4 +64,4 @@ def delete_dish(stall_id, dish_id): ...@@ -64,4 +64,4 @@ def delete_dish(stall_id, dish_id):
db.session.delete(dish) db.session.delete(dish)
db.session.commit() db.session.commit()
return redirect(url_for('stall', stall_id=stall_id)) return redirect(url_for('view_stall', stall_id=stall_id))
\ No newline at end of file \ No newline at end of file
...@@ -14,10 +14,10 @@ def stalls(): ...@@ -14,10 +14,10 @@ def stalls():
@app.route('/stalls/<int:stall_id>') @app.route('/stalls/<int:stall_id>')
@login_required @login_required
@stall_validate @stall_validate
def stall(stall_id): def view_stall(stall_id):
stall = Stall.query.get(stall_id) stall = Stall.query.get(stall_id)
dishes = stall.dishes.all() dishes = stall.dishes.all()
return render_template('stall.html', stall=stall, dishes=dishes, upload_folder=app.config['UPLOAD_FOLDER']) return render_template('view_stall.html', stall=stall, dishes=dishes, upload_folder=app.config['UPLOAD_FOLDER'])
@app.route('/stalls/new', methods=['GET','POST']) @app.route('/stalls/new', methods=['GET','POST'])
@login_required @login_required
...@@ -29,7 +29,7 @@ def new_stall(): ...@@ -29,7 +29,7 @@ def new_stall():
stall = Stall(form.name.data, form.description.data, current_user.id, form.location.data) stall = Stall(form.name.data, form.description.data, current_user.id, form.location.data)
db.session.add(stall) db.session.add(stall)
db.session.commit() db.session.commit()
return redirect(url_for('stall', stall_id=stall.id)) return redirect(url_for('view_stall', stall_id=stall.id))
else: else:
flash_form_errors(form) flash_form_errors(form)
return redirect(url_for('new_stall')) return redirect(url_for('new_stall'))
...@@ -51,7 +51,7 @@ def edit_stall(stall_id): ...@@ -51,7 +51,7 @@ def edit_stall(stall_id):
stall.description = form.description.data stall.description = form.description.data
stall.location_id = form.location.data stall.location_id = form.location.data
db.session.commit() db.session.commit()
return redirect(url_for('stall', stall_id=stall_id)) return redirect(url_for('view_stall', stall_id=stall_id))
else: else:
flash_form_errors(form) flash_form_errors(form)
return redirect(url_for('edit_stall', values=[('stall_id', stall_id)])) return redirect(url_for('edit_stall', values=[('stall_id', stall_id)]))
...@@ -70,4 +70,4 @@ def delete_stall(stall_id): ...@@ -70,4 +70,4 @@ def delete_stall(stall_id):
db.session.delete(stall) db.session.delete(stall)
db.session.commit() db.session.commit()
return redirect(url_for('stalls')) return redirect(url_for('view_stalls'))
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
<div class="dashboard-row"> <div class="dashboard-row">
<button type="submit">Apply</button> <button type="submit">Apply</button>
<a href="{{ url_for('stall', stall_id=stall.id) }}"><button type="button" class="link-button">Back</button></a> <a href="{{ url_for('view_stall', stall_id=stall.id) }}"><button type="button" class="link-button">Back</button></a>
</div> </div>
</form> </form>
</div> </div>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
<div class="dashboard-row"> <div class="dashboard-row">
<button type="submit">Submit</button> <button type="submit">Submit</button>
<a href="{{ url_for('stall', stall_id=stall.id) }}"><button type="button">Back</button></a> <a href="{{ url_for('view_stall', stall_id=stall.id) }}"><button type="button">Back</button></a>
</div> </div>
</div> </div>
</form> </form>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<span class="list-name">{{stall.name}}</span> <span class="list-name">{{stall.name}}</span>
</div> </div>
<div class="dashboard-row"> <div class="dashboard-row">
<a href="{{ url_for('stall', stall_id=stall.id) }}"><button class="list-button">Manage Stall</button></a> <a href="{{ url_for('view_stall', stall_id=stall.id) }}"><button class="list-button">Manage Stall</button></a>
<form action="{{ url_for('delete_stall', stall_id=stall.id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete {{stall.name}}?');"> <form action="{{ url_for('delete_stall', stall_id=stall.id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete {{stall.name}}?');">
<button type="submit" class="list-button button-delete">Delete</button> <button type="submit" class="list-button button-delete">Delete</button>
</form> </form>
......
...@@ -71,7 +71,7 @@ def dish_validate(f): ...@@ -71,7 +71,7 @@ def dish_validate(f):
return redirect(url_for('stalls')) return redirect(url_for('stalls'))
dish = Dish.query.get(dish_id) dish = Dish.query.get(dish_id)
if dish is None or dish.stall != stall: if dish is None or dish.stall != stall:
return redirect(url_for('stall', stall_id=stall_id)) return redirect(url_for('stall_view', stall_id=stall_id))
return f(*args, **kwargs) return f(*args, **kwargs)
return wrapper return wrapper
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment