Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS123-Canteeneo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Willard Torres
CS123-Canteeneo
Commits
b0a34063
Commit
b0a34063
authored
Nov 10, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename 'stall' endpoint to 'view_stall'
parent
d8c36fcd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
12 deletions
+12
-12
dish_views.py
canteeneo/dish_views.py
+3
-3
stall_views.py
canteeneo/stall_views.py
+5
-5
editdish.html
canteeneo/templates/editdish.html
+1
-1
editstall.html
canteeneo/templates/editstall.html
+1
-1
stalls.html
canteeneo/templates/stalls.html
+1
-1
viewstall.html
canteeneo/templates/viewstall.html
+0
-0
views.py
canteeneo/views.py
+1
-1
No files found.
canteeneo/dish_views.py
View file @
b0a34063
...
...
@@ -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
canteeneo/stall_views.py
View file @
b0a34063
...
...
@@ -14,10 +14,10 @@ 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'
])
return
render_template
(
'
view_
stall.html'
,
stall
=
stall
,
dishes
=
dishes
,
upload_folder
=
app
.
config
[
'UPLOAD_FOLDER'
])
@
app
.
route
(
'/stalls/new'
,
methods
=
[
'GET'
,
'POST'
])
@
login_required
...
...
@@ -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
canteeneo/templates/editdish.html
View file @
b0a34063
...
...
@@ -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>
...
...
canteeneo/templates/editstall.html
View file @
b0a34063
...
...
@@ -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>
...
...
canteeneo/templates/stalls.html
View file @
b0a34063
...
...
@@ -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>
...
...
canteeneo/templates/stall.html
→
canteeneo/templates/
view
stall.html
View file @
b0a34063
File moved
canteeneo/views.py
View file @
b0a34063
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment