def map_remove(request, mapid, template='maps/map_remove.html'): ''' Delete a map, and its constituent layers. ''' map_obj = _resolve_map(request, mapid, 'base.delete_resourcebase', _PERMISSION_MSG_VIEW) if request.method == 'GET': return render_to_response(template, RequestContext(request, { "map": map_obj })) elif request.method == 'POST': if getattr(settings, 'SLACK_ENABLED', False): slack_message = None try: from geonode.contrib.slack.utils import build_slack_message_map slack_message = build_slack_message_map("map_delete", map_obj) except: print "Could not build slack message for delete map." delete_map.delay(object_id=map_obj.id) try: from geonode.contrib.slack.utils import send_slack_messages send_slack_messages(slack_message) except: print "Could not send slack message for delete map." else: delete_map.delay(object_id=map_obj.id) return HttpResponseRedirect(reverse("maps_browse"))
def map_remove(request, mapid, template='maps/map_remove.html'): ''' Delete a map, and its constituent layers. ''' map_obj = _resolve_map(request, mapid, 'base.delete_resourcebase', _PERMISSION_MSG_VIEW) if request.method == 'GET': return render_to_response(template, RequestContext(request, {"map": map_obj})) elif request.method == 'POST': if getattr(settings, 'SLACK_ENABLED', False): slack_message = None try: from geonode.contrib.slack.utils import build_slack_message_map slack_message = build_slack_message_map("map_delete", map_obj) except: print "Could not build slack message for delete map." delete_map.delay(object_id=map_obj.id) try: from geonode.contrib.slack.utils import send_slack_messages send_slack_messages(slack_message) except: print "Could not send slack message for delete map." else: delete_map.delay(object_id=map_obj.id) return HttpResponseRedirect(reverse("maps_browse"))
def map_remove(request, mapid, template='maps/map_remove.html'): ''' Delete a map, and its constituent layers. ''' map_obj = _resolve_map(request, mapid, 'base.delete_resourcebase', _PERMISSION_MSG_VIEW) if request.method == 'GET': return render_to_response(template, RequestContext(request, { "map": map_obj })) elif request.method == 'POST': delete_map.delay(object_id=map_obj.id) return HttpResponseRedirect(reverse("maps_browse"))
def map_remove(request, mapid, template='maps/map_remove.html'): ''' Delete a map, and its constituent layers. ''' map_obj = _resolve_map(request, mapid, 'base.delete_resourcebase', _PERMISSION_MSG_VIEW) if request.method == 'GET': return render_to_response(template, RequestContext(request, {"map": map_obj})) elif request.method == 'POST': delete_map.delay(object_id=map_obj.id) return HttpResponseRedirect(reverse("index_view"))