Ejemplo n.º 1
0
def mapSetSave(request):
    """
    Update or create a new mapset from json properties.
    (See MapSet.fromJSON for the schema)
    """
    if request.method == 'POST':
        json_data = json.loads(request.raw_post_data)

        mapset = MapSet.fromJSON(json_data)
        mapset.save()

        # if 'extensions' in json_data:
        #     extensions = json_data['extensions']
        #     for extension in extensions.keys():
        #         e = Extension(
        at
        #             url = extensions[extension])
        #         mapset.extension_set.add(e)
        #         e.save()

        # if 'children' in json_data:
        #     children = json_data['children']
        #     for child in children:
        #         c = MapSetLayer.fromJSON(child)
        #         mapset.mapsetlayer_set.add(c)
        #         c.save()

    return HttpResponse("OK")
Ejemplo n.º 2
0
def mapSetSave(request):
    """
    Update or create a new mapset from json properties.
    (See MapSet.fromJSON for the schema)
    """
    if request.method == 'POST':
        json_data = json.loads(request.raw_post_data)

        mapset = MapSet.fromJSON(json_data)
        mapset.save()

        # if 'extensions' in json_data:
        #     extensions = json_data['extensions']
        #     for extension in extensions.keys():
        #         e = Extension(
        at
        #             url = extensions[extension])
        #         mapset.extension_set.add(e)
        #         e.save()

        # if 'children' in json_data:
        #     children = json_data['children']
        #     for child in children:
        #         c = MapSetLayer.fromJSON(child)
        #         mapset.mapsetlayer_set.add(c)
        #         c.save()

    return HttpResponse("OK")
Ejemplo n.º 3
0
def mapSetSet(request, userName, shortName):
    if request.method == 'POST':
        json_data = json.loads(request.raw_post_data)
        mapset = MapSet.fromJSON(userName, shortName, json_data)
        mapset.save()
        return HttpResponse("OK")
    else:
        # get: user is requesting map set
        s = get_object_or_404(MapSet,
                              author__username=userName,
                              shortName=shortName)
        return jsonResponse(s.json, raw=True)
Ejemplo n.º 4
0
def mapSetSet(request, userName, shortName):
    if request.method == 'POST':
        json_data = json.loads(request.raw_post_data)
        mapset = MapSet.fromJSON(userName, shortName, json_data)
        mapset.save()
        return HttpResponse("OK")
    else:
        # get: user is requesting map set
        s = get_object_or_404(MapSet,
                              author__username=userName,
                              shortName=shortName)
        return jsonResponse(s.json, raw=True)