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
dc5c864c
Commit
dc5c864c
authored
Nov 23, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dish_views wrong URL and no placeholders
parent
3ce6b7d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
dish_views.py
canteeneo/dish_views.py
+1
-1
forms.py
canteeneo/forms.py
+3
-3
No files found.
canteeneo/dish_views.py
View file @
dc5c864c
...
...
@@ -24,7 +24,7 @@ class NewDishView(FormView):
db
.
session
.
commit
()
return
redirect
(
url_for
(
'view_stall'
,
stall_id
=
self
.
stall
.
id
))
def
render_get
(
self
,
stall_id
):
return
render_template
(
'dishinfo.html'
,
form
=
self
.
get_form
(),
stall
=
self
.
stall
,
title
=
'New Dish'
,
form_action
=
url_for
(
'
stalls'
,
stall_id
=
stall_
id
),
submit_label
=
'Add'
)
return
render_template
(
'dishinfo.html'
,
form
=
self
.
get_form
(),
stall
=
self
.
stall
,
title
=
'New Dish'
,
form_action
=
url_for
(
'
new_dish'
,
stall_id
=
self
.
stall
.
id
),
submit_label
=
'Add'
)
def
get_form
(
self
):
form
=
DishRegisterForm
()
form
.
dish_type
.
choices
=
[(
dish_type
.
id
,
dish_type
.
name
)
for
dish_type
in
DishType
.
query
.
all
()]
...
...
canteeneo/forms.py
View file @
dc5c864c
...
...
@@ -64,10 +64,10 @@ class StallRegisterForm(FlaskForm):
return
True
class
DishRegisterForm
(
FlaskForm
):
name
=
StringField
(
'Name'
,
[
DataRequired
()])
description
=
TextAreaField
(
'Description'
,
[
DataRequired
()])
name
=
StringField
(
'Name'
,
[
DataRequired
()]
,
render_kw
=
{
"placeholder"
:
"Name"
}
)
description
=
TextAreaField
(
'Description'
,
[
DataRequired
()]
,
render_kw
=
{
"placeholder"
:
"Describe your dish"
}
)
image
=
FileField
(
'Image'
)
price
=
DecimalField
(
'Price'
,
[
DataRequired
()])
price
=
DecimalField
(
'Price'
,
[
DataRequired
()]
,
render_kw
=
{
"placeholder"
:
"Price"
}
)
dish_type
=
SelectField
(
'Type'
,
coerce
=
int
)
def
validate
(
self
,
editing
=
False
):
...
...
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