Commit d0cef508 authored by Krystyna Milian's avatar Krystyna Milian
parents 5fd683db 2b11291f
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,6 +14,9 @@ __revision__ = ""
__copyright__ = ""
__license__ = ""
#from bootstrap import db
from bootstrap import db
from sqlalchemy.sql import func
from flask import Blueprint, jsonify, request
from collections import defaultdict
from web.models import Shelter, Attribute, Property, Value, Association
......@@ -83,7 +86,12 @@ def allshelters():
subquery = queryfactory(Property,Attribute,Attribute.uniqueid,attr).subquery()
shelter_properties = Property.query.filter(Property.shelter_id==subquery.c.shelter_id).all()
shelter_properties = Property.query.all()
shelter_properties = db.session.query(Property.shelter_id,,func.string_agg(,"';'").label("value"))\
## value parameter listening
if request.args.getlist('attribute') and request.args.getlist('value'):
......@@ -98,8 +106,7 @@ def allshelters():
result[shelter_property.shelter_id][] = shelter_property.get_values_as_string()
for shelter_property in shelter_properties:
result[shelter_property.shelter_id][shelter_property.attribute.uniqueid] = shelter_property.get_values_as_string()
result[shelter_property.shelter_id][] = shelter_property.value
return jsonify(result)
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