def getByUnitId(unitid): photos = meta.Session.query(Unitphoto).filter_by(unitid=unitid).all() photo_arr = [] for photo in photos: photo_arr.append({ 'id':photo.id, 'photo': Photo.path(photo.photoid), 'thumb': Photo.path(photo.thumbid)}) return photo_arr
def get(id): photo = meta.Session.query(Unitphoto).filter_by(id=id).first() return [{'id':photo.id, 'photo': Photo.path(photo.photoid), 'thumb': Photo.path(photo.thumbid)}]