equal
deleted
inserted
replaced
30 c = Context({'form': ParticipantForm(), |
30 c = Context({'form': ParticipantForm(), |
31 'value': True, |
31 'value': True, |
32 }) |
32 }) |
33 return render_to_response(template_name, |
33 return render_to_response(template_name, |
34 context_instance = c) |
34 context_instance = c) |
35 |
|
36 #to create the dump of content shown in text box and then making it downloadable |
|
37 def file_archive(request): |
|
38 if request.method == 'POST': |
|
39 form = Uploaded_fileForm(request.POST, request.FILES) |
|
40 if form.is_valid(): |
|
41 response = HttpResponse(mimetype='application/tar') |
|
42 response['Content-Disposition'] = 'attachment; filename=content.tar' |
|
43 content = open('download.txt','w') |
|
44 content.write(form.cleaned_data['content']) |
|
45 content.close() |
|
46 tar = tarfile.open('download.tar','w') |
|
47 tar.add('download.txt') |
|
48 tar.close() |
|
49 response.write(open('download.tar').read()) |
|
50 return response |
|
51 return HttpResponseRedirect('/ocr/') |
|
52 |
|