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) }
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)
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)