Basically, I get the place data with longitude and latitude, calculate it if it's more than 3000 miles, remove that row from Rows. I am sure that this is wrong. If I can remove the row from fetch rows, how can I add extra columns to the rows for distance between two points? P.S the result has to be Jsoned.
Here's the code def tester(): items = db(db.dine_promotion.place_id==db.place.id).select() latitude =float(23.790457) longitude =float(-47.602542) for row in items: if row.place.latitude: a=float(row.place.latitude) b=float(row.place.longitude) dist="%.2f" % calc_distance(latitude,longitude,a,b) if dist > 3000: items.remove(row) return dict(restaurants = items) --