login_required def ct_file_add request ct_id if request method POST fo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
@login_required
def ct_file_add(request, ct_id):
if request.method == 'POST':
form = CtFileForm(request.POST, request.FILES)
if form.is_valid():
_handle_uploaded_file(request.FILES['ct_file'])
return HttpResponseRedirect('/ct/view/%s' % ct_id)
else:
form = CtFileForm()
# Create the template, context, response
t = loader.get_template('ct/upload.html')
c = RequestContext(request, {
'form': form,
},)
return HttpResponse(t.render(c))
#return render_to_response('ct/upload.html', {'form': form})