Ejemplo n.º 1
0
def map_refresh(request, map_id):
    """
    Returns an HttpResponse with the updated systemJSON for an asynchronous
    map refresh.
    """
    if not request.is_ajax():
        raise PermissionDenied
    current_map = get_object_or_404(Map, pk=map_id)
    result = [
        datetime.now(pytz.utc).strftime("%Y-%m-%d %H:%M:%S.%f"),
        utils.MapJSONGenerator(current_map, request.user).get_systems_json(),
    ]
    return HttpResponse(json.dumps(result))
Ejemplo n.º 2
0
 def as_json(self, user):
     """
     Returns the json representation of the map for the mapping Javascript.
     """
     return utils.MapJSONGenerator(self, user).get_systems_json()