Exemple #1
0
 def json(self):
     return {
         "map": self.map.id,
         "created": self.created_dttm.isoformat(),
         "user": self.user.username if self.user else None,
         "url": num_encode(self.id)
     }
Exemple #2
0
 def json(self):
     return {
         "map": self.map.id,
         "created": self.created_dttm.isoformat(),
         "user": self.user.username if self.user else None,
         "url": num_encode(self.id)
     }
Exemple #3
0
def snapshot_create(request):
    """
    Create a permalinked map
    """
    conf = request.body

    if isinstance(conf, basestring):
        config = json.loads(conf)
        snapshot = MapSnapshot.objects.create(config=clean_config(conf),map=Map.objects.get(id=config['id']))
        return HttpResponse(num_encode(snapshot.id), mimetype="text/plain")
    else:
        return HttpResponse("Invalid JSON", mimetype="text/plain", status=500)
Exemple #4
0
def snapshot_create(request):
    """
    Create a permalinked map
    """
    conf = request.body

    if isinstance(conf, basestring):
        config = json.loads(conf)
        snapshot = MapSnapshot.objects.create(
            config=clean_config(conf), map=Map.objects.get(id=config['id']))
        return HttpResponse(num_encode(snapshot.id), mimetype="text/plain")
    else:
        return HttpResponse("Invalid JSON", mimetype="text/plain", status=500)