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
b8f94fa9
Commit
b8f94fa9
authored
Oct 22, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass stall id instead of stall object to Dish constuctor
parent
29f85a36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
controllers.py
canteeneo/controllers.py
+1
-1
models.py
canteeneo/models.py
+2
-2
No files found.
canteeneo/controllers.py
View file @
b8f94fa9
...
@@ -135,7 +135,7 @@ def new_dish(stall_id):
...
@@ -135,7 +135,7 @@ def new_dish(stall_id):
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
if
form
.
validate
():
if
form
.
validate
():
filename
=
secure_filename
(
form
.
image
.
data
.
filename
)
filename
=
secure_filename
(
form
.
image
.
data
.
filename
)
dish
=
Dish
(
form
.
name
.
data
,
form
.
description
.
data
,
form
.
price
.
data
,
stall
,
filename
)
dish
=
Dish
(
form
.
name
.
data
,
form
.
description
.
data
,
form
.
price
.
data
,
stall
.
id
,
filename
)
form
.
image
.
data
.
save
(
os
.
path
.
join
(
app
.
config
[
'UPLOAD_FOLDER'
],
filename
))
form
.
image
.
data
.
save
(
os
.
path
.
join
(
app
.
config
[
'UPLOAD_FOLDER'
],
filename
))
db
.
session
.
add
(
dish
)
db
.
session
.
add
(
dish
)
db
.
session
.
commit
()
db
.
session
.
commit
()
...
...
canteeneo/models.py
View file @
b8f94fa9
...
@@ -38,11 +38,11 @@ class Dish(db.Model):
...
@@ -38,11 +38,11 @@ class Dish(db.Model):
favorites
=
db
.
relationship
(
'User'
,
secondary
=
dish_favorites
,
backref
=
db
.
backref
(
'dish'
,
lazy
=
'dynamic'
))
favorites
=
db
.
relationship
(
'User'
,
secondary
=
dish_favorites
,
backref
=
db
.
backref
(
'dish'
,
lazy
=
'dynamic'
))
reviews
=
db
.
relationship
(
'DishReview'
,
backref
=
'dish'
,
lazy
=
'dynamic'
)
reviews
=
db
.
relationship
(
'DishReview'
,
backref
=
'dish'
,
lazy
=
'dynamic'
)
def
__init__
(
self
,
name
,
description
,
price
,
stall
,
image_path
):
def
__init__
(
self
,
name
,
description
,
price
,
stall
_id
,
image_path
):
self
.
name
=
name
self
.
name
=
name
self
.
description
=
description
self
.
description
=
description
self
.
price
=
price
self
.
price
=
price
self
.
stall_id
=
stall
.
id
self
.
stall_id
=
stall
_
id
self
.
image_path
=
image_path
self
.
image_path
=
image_path
class
Owner
(
db
.
Model
):
class
Owner
(
db
.
Model
):
...
...
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