Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CHARISM
Shelter Database
Commits
fbbf1c6b
Commit
fbbf1c6b
authored
Sep 05, 2016
by
Cédric Bonhomme
Browse files
Merge branch 'master' of
https://github.com/rodekruis/shelter-database
parents
b1d5bd4f
a1dfa9ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/web/views/shelterapiv02.py
View file @
fbbf1c6b
...
...
@@ -148,7 +148,7 @@ def allshelters(shelter_id=None):
result
=
tree
()
#shelter pictures folder path
picpath
=
'
data
/shelters/pictures'
picpath
=
'
/public
/shelters/pictures'
Supercategory
=
db
.
aliased
(
Category
)
...
...
@@ -210,11 +210,11 @@ def allshelters(shelter_id=None):
for
picture
in
shelter_pictures
:
if
picture
.
is_main_picture
==
True
:
result
[
picture
.
shelter_id
][
"Identification"
][
"Cover"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
result
[
picture
.
shelter_id
][
"Identification"
][
"Attributes"
][
"ID"
]
,
picture
.
filename
)]
result
[
picture
.
shelter_id
][
"Identification"
][
"Cover"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
picture
.
shelter_id
,
picture
.
filename
)]
elif
not
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
]:
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
result
[
picture
.
shelter_id
][
"Identification"
][
"Attributes"
][
"ID"
]
,
picture
.
filename
)]
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
picture
.
shelter_id
,
picture
.
filename
)]
else
:
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
].
append
(
"{}/{}/{}"
.
format
(
picpath
,
result
[
picture
.
shelter_id
][
"Identification"
][
"Attributes"
][
"ID"
]
,
picture
.
filename
))
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
].
append
(
"{}/{}/{}"
.
format
(
picpath
,
picture
.
shelter_id
,
picture
.
filename
))
else
:
for
shelter_property
in
shelter_properties
:
...
...
@@ -222,10 +222,10 @@ def allshelters(shelter_id=None):
for
picture
in
shelter_pictures
:
if
picture
.
is_main_picture
==
True
:
result
[
picture
.
shelter_id
][
"Identification"
][
"Cover"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
result
[
picture
.
shelter_id
][
"Identification"
][
"Attributes"
][
"id"
]
,
picture
.
filename
)]
result
[
picture
.
shelter_id
][
"Identification"
][
"Cover"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
picture
.
shelter_id
,
picture
.
filename
)]
elif
not
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
]:
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
result
[
picture
.
shelter_id
][
"Identification"
][
"Attributes"
][
"id"
]
,
picture
.
filename
)]
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
]
=
[
"{}/{}/{}"
.
format
(
picpath
,
picture
.
shelter_id
,
picture
.
filename
)]
else
:
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
].
append
(
"{}/{}/{}"
.
format
(
picpath
,
result
[
picture
.
shelter_id
][
"Identification"
][
"Attributes"
][
"id"
]
,
picture
.
filename
))
result
[
picture
.
shelter_id
][
picture
.
name
][
"Pictures"
].
append
(
"{}/{}/{}"
.
format
(
picpath
,
picture
.
shelter_id
,
picture
.
filename
))
return
jsonify
(
result
)
\ No newline at end of file
return
jsonify
(
result
)
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