Commit 2c795dfb authored by Willard's avatar Willard

Rename 'stall' endpoint to 'view_stall'

parent d8c36fcd
......@@ -22,7 +22,7 @@ def new_dish(stall_id):
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
db.session.add(dish)
db.session.commit()
return redirect(url_for('stall', stall_id=stall.id))
return redirect(url_for('view_stall', stall_id=stall.id))
else:
flash_form_errors(form)
return redirect(url_for('new_dish', stall_id=stall.id))
......@@ -45,7 +45,7 @@ def edit_dish(stall_id, dish_id):
dish.image_path = secure_filename(form.image.data.filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path))
db.session.commit()
return redirect(url_for('stall', stall_id=stall_id))
return redirect(url_for('view_stall', stall_id=stall_id))
else:
flash_form_errors(form)
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):
db.session.delete(dish)
db.session.commit()
return redirect(url_for('stall', stall_id=stall_id))
\ No newline at end of file
return redirect(url_for('view_stall', stall_id=stall_id))
\ No newline at end of file
......@@ -14,7 +14,7 @@ def stalls():
@app.route('/stalls/<int:stall_id>')
@login_required
@stall_validate
def stall(stall_id):
def view_stall(stall_id):
stall = Stall.query.get(stall_id)
dishes = stall.dishes.all()
return render_template('stall.html', stall=stall, dishes=dishes, upload_folder=app.config['UPLOAD_FOLDER'])
......@@ -29,7 +29,7 @@ def new_stall():
stall = Stall(form.name.data, form.description.data, current_user.id, form.location.data)
db.session.add(stall)
db.session.commit()
return redirect(url_for('stall', stall_id=stall.id))
return redirect(url_for('view_stall', stall_id=stall.id))
else:
flash_form_errors(form)
return redirect(url_for('new_stall'))
......@@ -51,7 +51,7 @@ def edit_stall(stall_id):
stall.description = form.description.data
stall.location_id = form.location.data
db.session.commit()
return redirect(url_for('stall', stall_id=stall_id))
return redirect(url_for('view_stall', stall_id=stall_id))
else:
flash_form_errors(form)
return redirect(url_for('edit_stall', values=[('stall_id', stall_id)]))
......@@ -70,4 +70,4 @@ def delete_stall(stall_id):
db.session.delete(stall)
db.session.commit()
return redirect(url_for('stalls'))
\ No newline at end of file
return redirect(url_for('view_stalls'))
\ No newline at end of file
......@@ -22,7 +22,7 @@
</div>
<div class="dashboard-row">
<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>
</form>
</div>
......
......@@ -18,7 +18,7 @@
</div>
<div class="dashboard-row">
<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>
</form>
......
......@@ -18,7 +18,7 @@
<span class="list-name">{{stall.name}}</span>
</div>
<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}}?');">
<button type="submit" class="list-button button-delete">Delete</button>
</form>
......
......@@ -71,7 +71,7 @@ def dish_validate(f):
return redirect(url_for('stalls'))
dish = Dish.query.get(dish_id)
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 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