Esempio n. 1
0
def upload_sketch(request):
    if request.method == 'POST':
        form = UploadSketchForm(request.POST, request.FILES)
        if form.is_valid():
            sketch_name = __handle_uploaded_file(request.FILES['file'])
            return HttpResponseRedirect(rurl('view_sketch_code', sketch_name))
    else:
        form = UploadSketchForm()
    return rtr('processing/upload.html')
Esempio n. 2
0
def upload_sketch(request):
    if request.method == 'POST':
        form = UploadSketchForm(request.POST, request.FILES)
        if form.is_valid():
            sketch_name = __handle_uploaded_file(request.FILES['file'])
            return HttpResponseRedirect(rurl('view_sketch_code', sketch_name))
    else:
        form = UploadSketchForm()
    return rtr('processing/upload.html')
Esempio n. 3
0
def upload_sketch(request):
    if request.method == 'POST':
        form = UploadSketchForm(request.POST, request.FILES)
        if form.is_valid():
            sketch_name = request.FILES['file'].name
            sketch, _ = QuartzSketch.objects.get_or_create(name=sketch_name)
            sketch.name = sketch_name
            sketch.file = request.FILES['file']
            sketch.save()
            return HttpResponseRedirect(rurl('view_quartz_sketch',
                                             sketch.name))
    else:
        form = UploadSketchForm()
    return rtr('quartz/upload.html')