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
bd3a8a20
Commit
bd3a8a20
authored
Nov 23, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dish edits not registering correctly
parent
d16d55bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
dish_views.py
canteeneo/dish_views.py
+1
-0
forms.py
canteeneo/forms.py
+3
-2
No files found.
canteeneo/dish_views.py
View file @
bd3a8a20
...
@@ -62,6 +62,7 @@ class EditDishView(FormView):
...
@@ -62,6 +62,7 @@ class EditDishView(FormView):
def
get_form
(
self
):
def
get_form
(
self
):
form
=
DishRegisterForm
()
form
=
DishRegisterForm
()
form
.
dish_type
.
choices
=
[(
dish_type
.
id
,
dish_type
.
name
)
for
dish_type
in
DishType
.
query
.
all
()]
form
.
dish_type
.
choices
=
[(
dish_type
.
id
,
dish_type
.
name
)
for
dish_type
in
DishType
.
query
.
all
()]
form
.
editing
=
True
return
form
return
form
class
DeleteDishView
(
View
):
class
DeleteDishView
(
View
):
...
...
canteeneo/forms.py
View file @
bd3a8a20
...
@@ -69,13 +69,14 @@ class DishRegisterForm(FlaskForm):
...
@@ -69,13 +69,14 @@ class DishRegisterForm(FlaskForm):
image
=
FileField
(
'Image'
)
image
=
FileField
(
'Image'
)
price
=
DecimalField
(
'Price'
,
[
DataRequired
()],
render_kw
=
{
"placeholder"
:
"Price"
})
price
=
DecimalField
(
'Price'
,
[
DataRequired
()],
render_kw
=
{
"placeholder"
:
"Price"
})
dish_type
=
SelectField
(
'Type'
,
coerce
=
int
)
dish_type
=
SelectField
(
'Type'
,
coerce
=
int
)
editing
=
False
def
validate
(
self
,
editing
=
False
):
def
validate
(
self
,
editing
=
False
):
if
not
FlaskForm
.
validate
(
self
):
if
not
FlaskForm
.
validate
(
self
):
return
False
return
False
dish
=
Dish
.
query
.
filter_by
(
name
=
self
.
name
.
data
)
.
first
()
dish
=
Dish
.
query
.
filter_by
(
name
=
self
.
name
.
data
)
.
first
()
if
not
editing
:
if
not
self
.
editing
:
if
dish
is
not
None
:
if
dish
is
not
None
:
flash
(
'Dish name is taken!'
)
flash
(
'Dish name is taken!'
)
return
False
return
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