def get(self): is_json = self.content_type("application/json") name = self.get_argument("name", None, json=is_json) name_search = self.get_argument("name_search", None, json=is_json) tag_name_list = self.get_arguments("tag", json=is_json) offset = self.get_argument_int("offset", None, json=is_json) if self.deep_visible(): address_list_name = "address_list" else: address_list_name = "address_list_public" org_list, org_count, geobox, latlon = self._get_org_list_search( name=name, name_search=name_search, tag_name_list=tag_name_list, visibility=self.parameters["visibility"], address_list_name=address_list_name, offset=offset, ) if self.has_geo_arguments(): offset = None org_packet = { "org_list": [], "org_count": org_count, "geobox": geobox, "latlon": latlon, } if offset is not None: org_packet["offset"] = offset for org in org_list: if self.deep_visible(): address_list = org.address_list else: address_list = org.address_list_public address_list = [address.obj(public=bool(self.current_user)) \ for address in address_list] obj = org.obj( public=bool(self.current_user), address_obj_list=address_list, ) org_packet["org_list"].append(obj); if self.accept_type("json"): self.write_json(org_packet) else: full_orgtag_list = BaseOrgtagHandler._get_full_orgtag_list(self) self.render( 'organisation_list.html', org_packet=org_packet, name_search=name_search, tag_name_list=tag_name_list, lookup=self.lookup, orgtag_list_json=json.dumps(full_orgtag_list), )
def get(self, org_id_string): # org... if self.deep_visible(): options = ( joinedload("orgtag_list"), ) else: options = ( joinedload("orgtag_list_public"), ) org = self._get_org(org_id_string, options=options) if self.deep_visible(): orgtag_list=org.orgtag_list else: orgtag_list=org.orgtag_list_public public = bool(self.current_user) orgtag_list = [orgtag.obj(public=public) for orgtag in orgtag_list] obj = org.obj( public=public, orgtag_obj_list=orgtag_list, ) # orgtag... orgtag_and_org_count_list, name, short, search = \ BaseOrgtagHandler._get_orgtag_and_org_count_list_search_and_args(self) orgtag_list = [] for orgtag, org_count in orgtag_and_org_count_list: orgtag_list.append(orgtag.obj( public=bool(self.current_user), org_len=org_count, )) self.render( 'entity_tag.html', obj=obj, tag_list=orgtag_list, search=search, type_title="Organisation", type_title_plural="Organisations", type_url="organisation", type_tag_list="orgtag_list", type_entity_list="org_list", type_li_template="org_li", )