def taxon_count(args, id): data = {} taxon = Taxon.query.get_or_404(id) for relation in args['relation']: _, base = relation.rsplit('/', 1) data[base] = utils.count_relation(taxon, relation) return utils.json_response(data)
def accession_count(args, id): data = {} accession = Accession.query.get_or_404(id) for relation in args['relation']: _, base = relation.rsplit('/', 1) data[base] = utils.count_relation(accession, relation) return utils.json_response(data)
def genus_count(args, id): data = {} genus = Genus.query.get_or_404(id) for relation in args['relation']: _, base = relation.rsplit('/', 1) data[base] = utils.count_relation(genus, relation) return utils.json_response(data)
def family_count(args, family_id): data = {} family = Family.query.get_or_404(family_id) for relation in args['relation']: _, base = relation.rsplit('/', 1) data[base] = utils.count_relation(family, relation) return utils.json_response(data)
def location_count(args, location_id): data = {} location = Location.query.get_or_404(location_id) for relation in args['relation']: _, base = relation.rsplit('/', 1) data[base] = utils.count_relation(location, relation) return utils.json_response(data)
def plant_count(args, id): data = {} plant = Plant.query.get_or_404(id) for relation in args['relation']: _, base = relation.rsplit('/', 1) data[base] = utils.count_relation(plant, relation) return utils.json_response(data)
def show(id): taxon = Taxon.query \ .options(orm.joinedload(*Taxon.synonyms.attr)) \ .get_or_404(id) if request.prefers_json: return resource.render_json(taxon) relations = ['/accessions', '/accessions/plants'] counts = {} for relation in relations: _, base = relation.rsplit('/', 1) counts[base] = utils.count_relation(taxon, relation) return resource.render_html(taxon=taxon, counts=counts)
def show(id): genus = Genus.query \ .options(orm.joinedload(*Genus.synonyms.attr)) \ .get_or_404(id) if request.prefers_json: return resource.render_json(genus) relations = ['/taxa', '/taxa/accessions', '/taxa/accessions/plants'] counts = {} for relation in relations: _, base = relation.rsplit('/', 1) counts[base] = utils.count_relation(genus, relation) return resource.render_html(genus=genus, counts=counts)
def show(id): family = Family.query \ .options(orm.joinedload(*Family.synonyms.attr)) \ .get_or_404(id) if request.prefers_json: return resource.render_json(family) relations = ['/genera', '/genera/taxa', '/genera/taxa/accessions', '/genera/taxa/accessions/plants'] counts = {} for relation in relations: _, base = relation.rsplit('/', 1) counts[base] = utils.count_relation(family, relation) return resource.render_html(family=family, counts=counts)
def show(id): family = Family.query \ .options(orm.joinedload(*Family.synonyms.attr)) \ .get_or_404(id) if request.prefers_json: return resource.render_json(family) relations = [ '/genera', '/genera/taxa', '/genera/taxa/accessions', '/genera/taxa/accessions/plants' ] counts = {} for relation in relations: _, base = relation.rsplit('/', 1) counts[base] = utils.count_relation(family, relation) return resource.render_html(family=family, counts=counts)