def shelter_unit():
 def prep(r):
  if (r.representation == 'plain'):
   record_id = r.id
   table = s3db.cr_shelter_unit
   row = db((table.id == record_id)).select(table.shelter_id, limitby=(0, 1)).first()
   shelter_id = row.shelter_id
   s3db.configure('cr_shelter_unit', popup_url=URL(c='cr', f='shelter', args=[shelter_id, 'shelter_unit', record_id]))
   return True
  elif ((r.representation in ('json', 'geojson', 'plain')) or (r.method == 'import')):
   return True
  return False
 s3.prep = prep
 return s3_rest_controller()

def shelter_unit ( ) : def prep ( r ) : if ( r . representation == 'plain' ) : record_id = r . id table = s3db . cr_shelter_unit row = db ( ( table . id == record_id ) ) . select ( table . shelter_id , limitby = ( 0 , 1 ) ) . first ( ) shelter_id = row . shelter_id s3db . configure ( 'cr_shelter_unit' , popup_url = URL ( c = 'cr' , f = 'shelter' , args = [ shelter_id , 'shelter_unit' , record_id ] ) ) return True elif ( ( r . representation in ( 'json' , 'geojson' , 'plain' ) ) or ( r . method == 'import' ) ) : return True return False s3 . prep = prep return s3_rest_controller ( )
rest controller to retrieve options for shelter unit selection show layer on map imports .