예제 #1
0
def graph(request):
    if request.method == "POST":
        
        graph = Graph()
        graph.title = request.POST["title"]
        graph.timetric_id = request.POST["id"]
        graph.user = request.user
        graph.save() # need this save to make sure there's an ID!
        
        token = RemoteToken.objects.filter(user=request.user)[0]
        source_uuid = add_new_timetric_source(token, graph.title, graph.id)

        graph.coda_source_id = source_uuid
        graph.save()
        
        
        return HttpResponseRedirect(urlresolvers.reverse("graph-view", args=[graph.pk,]))
    else:
        return HttpResponseNotAllowed(["POST",])