Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Shelter Database
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
CHARISM
Shelter Database
Commits
fbbf1c6b
Commit
fbbf1c6b
authored
Sep 05, 2016
by
Cédric Bonhomme
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/rodekruis/shelter-database
parents
b1d5bd4f
a1dfa9ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/web/views/shelterapiv02.py
src/web/views/shelterapiv02.py
+8
-8
No files found.
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