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
da1dcb2d
Commit
da1dcb2d
authored
Nov 15, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize stall_views.py
parent
976825e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
stall_views.py
canteeneo/stall_views.py
+11
-15
No files found.
canteeneo/stall_views.py
View file @
da1dcb2d
...
...
@@ -12,17 +12,6 @@ class StallListView(View):
def
dispatch_request
(
self
):
return
render_template
(
'stalls.html'
,
owner
=
current_user
,
stalls
=
current_user
.
stalls
.
all
())
app
.
add_url_rule
(
'/stalls'
,
view_func
=
StallListView
.
as_view
(
'stalls'
),
methods
=
[
'GET'
])
class
StallView
(
View
):
decorators
=
[
login_required
,
stall_validate
]
def
dispatch_request
(
self
,
stall_id
):
stall
=
Stall
.
query
.
get
(
stall_id
)
dishes
=
stall
.
dishes
.
all
()
return
render_template
(
'viewstall.html'
,
stall
=
stall
,
dishes
=
dishes
,
upload_folder
=
app
.
config
[
'UPLOAD_FOLDER'
])
app
.
add_url_rule
(
'/stalls/<int:stall_id>'
,
view_func
=
StallView
.
as_view
(
'view_stall'
),
methods
=
[
'GET'
])
class
NewStallView
(
FormView
):
decorators
=
[
login_required
]
def
render_post
(
self
):
...
...
@@ -38,7 +27,12 @@ class NewStallView(FormView):
form
.
location
.
choices
=
[(
loc
.
id
,
loc
.
name
)
for
loc
in
Location
.
query
.
all
()]
return
form
app
.
add_url_rule
(
'/stalls/new'
,
view_func
=
NewStallView
.
as_view
(
'new_stall'
))
class
StallView
(
View
):
decorators
=
[
login_required
,
stall_validate
]
def
dispatch_request
(
self
,
stall_id
):
stall
=
Stall
.
query
.
get
(
stall_id
)
dishes
=
stall
.
dishes
.
all
()
return
render_template
(
'viewstall.html'
,
stall
=
stall
,
dishes
=
dishes
,
upload_folder
=
app
.
config
[
'UPLOAD_FOLDER'
])
class
EditStallView
(
FormView
):
decorators
=
[
login_required
,
stall_validate
]
...
...
@@ -64,8 +58,6 @@ class EditStallView(FormView):
form
.
editing
=
True
return
form
app
.
add_url_rule
(
'/stalls/<int:stall_id>/edit'
,
view_func
=
EditStallView
.
as_view
(
'edit_stall'
))
class
DeleteStallView
(
View
):
decorators
=
[
login_required
,
stall_validate
]
def
dispatch_request
(
self
,
stall_id
):
...
...
@@ -74,4 +66,8 @@ class DeleteStallView(View):
db
.
session
.
commit
()
return
redirect
(
url_for
(
'view_stall'
),
stall_id
=
stall_id
)
app
.
add_url_rule
(
'/stalls'
,
view_func
=
StallListView
.
as_view
(
'stalls'
),
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/stalls/new'
,
view_func
=
NewStallView
.
as_view
(
'new_stall'
))
app
.
add_url_rule
(
'/stalls/<int:stall_id>'
,
view_func
=
StallView
.
as_view
(
'view_stall'
),
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/stalls/<int:stall_id>/edit'
,
view_func
=
EditStallView
.
as_view
(
'edit_stall'
))
app
.
add_url_rule
(
'/stalls/<int:stall_id>/delete'
,
view_func
=
DeleteStallView
.
as_view
(
'delete_stall'
),
methods
=
[
'POST'
])
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