def render_map(request, share_token): entity_preference = get_entity_preference_by_share_token( get_db_manager("public"), share_token) dbm = get_db_manager(entity_preference.org_id) if not _flag_active("idnr_map", entity_preference.org_id.split('_')[-1].upper()): raise Http404 form_model = get_form_model_by_entity_type( dbm, [entity_preference.entity_type.lower()]) return render_to_response('map.html', { "entity_type": entity_preference.entity_type, "filters": _get_filters(form_model, entity_preference.filters), "geo_jsons": geo_jsons(dbm, entity_preference.entity_type, request.GET, entity_preference.details, entity_preference.specials), "fallback_location": entity_preference.fallback_location, "mapbox_api_key": get_mapbox_api_key(request.META['HTTP_HOST']) }, context_instance=RequestContext(request))
def map_data(request, entity_type=None, entity_preference=None): manager = get_database_manager(request.user) form_model = get_form_model_by_entity_type(manager, [entity_type.lower()]) entity_preference = entity_preference or get_entity_preference(get_db_manager("public"), _get_organization_id(request), entity_type) details = entity_preference.details if entity_preference is not None else [] specials = entity_preference.specials if entity_preference is not None else [] fallback_location = entity_preference.fallback_location if entity_preference is not None else {} return render_to_response('map.html', { "entity_type": entity_type, "fallback_location": fallback_location, "filters": [] if entity_preference is None else _get_filters(form_model, entity_preference.filters), "idnr_filters": [] if entity_preference is None else _get_uniqueid_filters(form_model, entity_preference.filters, manager), "geo_jsons": geo_jsons(manager, entity_type, request.GET, details, specials), "mapbox_api_key": get_mapbox_api_key(request.META['HTTP_HOST']) }, context_instance=RequestContext(request))
def map_data(request, entity_type=None, entity_preference=None, map_view = False): manager = get_database_manager(request.user) form_model = get_form_model_by_entity_type(manager, [entity_type.lower()]) entity_preference = entity_preference or get_entity_preference(get_db_manager("public"), _get_organization_id(request), entity_type) details = entity_preference.details if entity_preference is not None else [] specials = entity_preference.specials if entity_preference is not None else [] total_in_label = entity_preference.total_in_label if entity_preference is not None else False entity_fields = manager.view.registration_form_model_by_entity_type(key=[entity_type], include_docs=True)[0]["doc"]["json_fields"] forward_filters, reverse_filters = _transform_filters(dict(request.GET), entity_fields) fallback_location = entity_preference.fallback_location if entity_preference is not None and not any(forward_filters) and not any(reverse_filters) else {} return render_to_response('map.html', { "entity_type": entity_type, "fallback_location": fallback_location, "filters": [] if entity_preference is None else _get_filters(form_model, entity_preference.filters, entity_preference.remove_options), "idnr_filters": [] if entity_preference is None else _get_uniqueid_filters(form_model, entity_preference.filters, manager, entity_preference.remove_options), "geo_jsons": geo_jsons(manager, entity_type, request.GET, details, specials, map_view, total_in_label), "mapbox_api_key": get_mapbox_api_key(request.META['HTTP_HOST']) }, context_instance=RequestContext(request))