Commit 56b170c6 authored by Maarten van der Veen's avatar Maarten van der Veen
parents db718593 d26559bf
...@@ -164,6 +164,7 @@ def allshelters(shelter_id=None): ...@@ -164,6 +164,7 @@ def allshelters(shelter_id=None):
.join(Category, Category.id == ShelterPicture.category_id) .join(Category, Category.id == ShelterPicture.category_id)
catquery = db.session.query(Category.name).filter(Category.section_id != None) catquery = db.session.query(Category.name).filter(Category.section_id != None)
##queries if no request arguments ##queries if no request arguments
shelter_properties = querybase shelter_properties = querybase
shelter_pictures = picquerybase shelter_pictures = picquerybase
...@@ -204,8 +205,8 @@ def allshelters(shelter_id=None): ...@@ -204,8 +205,8 @@ def allshelters(shelter_id=None):
#print(shelter_properties) #print(shelter_properties)
#print(shelter_pictures) #print(shelter_pictures)
print(catquery)
if request.args.get('format') == 'prettytext':
for shelter_property in shelter_properties: for shelter_property in shelter_properties:
if not result[shelter_property.shelter_id]: if not result[shelter_property.shelter_id]:
for category in catquery: for category in catquery:
...@@ -213,18 +214,13 @@ def allshelters(shelter_id=None): ...@@ -213,18 +214,13 @@ def allshelters(shelter_id=None):
result[shelter_property.shelter_id][category.name]["Cover"] result[shelter_property.shelter_id][category.name]["Cover"]
result[shelter_property.shelter_id][category.name]["Attributes"] result[shelter_property.shelter_id][category.name]["Attributes"]
result[shelter_property.shelter_id][category.name]["Pictures"] result[shelter_property.shelter_id][category.name]["Pictures"]
result[shelter_property.shelter_id][shelter_property.supercategory_name]["Attributes"][shelter_property.name] = shelter_property.value
if request.args.get('format') == 'prettytext':
result[shelter_property.shelter_id][shelter_property.supercategory_name]["Attributes"][shelter_property.name] = shelter_property.value
else: else:
for shelter_property in shelter_properties:
if not result[shelter_property.shelter_id]:
for category in catquery:
if category.name == "Identification":
result[shelter_property.shelter_id][category.name]["Cover"]
result[shelter_property.shelter_id][category.name]["Attributes"]
result[shelter_property.shelter_id][category.name]["Pictures"]
result[shelter_property.shelter_id][shelter_property.supercategory_name]["Attributes"][shelter_property.uniqueid] = shelter_property.value result[shelter_property.shelter_id][shelter_property.supercategory_name]["Attributes"][shelter_property.uniqueid] = shelter_property.value
for picture in shelter_pictures: for picture in shelter_pictures:
if picture.is_main_picture == True: if picture.is_main_picture == True:
result[picture.shelter_id]["Identification"]["Cover"] = ["{}/{}/{}".format(picpath, picture.shelter_id, picture.filename)] result[picture.shelter_id]["Identification"]["Cover"] = ["{}/{}/{}".format(picpath, picture.shelter_id, picture.filename)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment