--- a/upload/views.py Wed Sep 02 21:08:39 2009 +0530
+++ b/upload/views.py Wed Sep 02 23:25:20 2009 +0530
@@ -14,21 +14,13 @@
destination.close()
#view to handle uploaded file, showing content of file, and option of uploading a file
-def upload_file(request,template_name='index.html'):
+def upload_file(request, template_name='index.html'):
if request.method == 'POST':
- form = FileForm(request.POST, request.FILES)
+ form = ParticipantForm(request.POST, request.FILES)
if form.is_valid():
- #if else for checking the size of uploaded file
- handle_uploaded_file(request.FILES['file'])
- uploaded_form = Uploaded_fileForm(initial={'content': open(request.FILES['file'].name).read()})
- c = Context({'form': uploaded_form,
- 'value': False,
- })
- #display a page with textbox and all the content of file
- return render_to_response(template_name,
- context_instance = c)
- c = Context({'form': ParticipantForm(),
- 'value': True,
- })
+ #handle_uploaded_file(request.FILES['file'])
+ form.save()
+ return render_to_response(template_name, {'form': ParticipantForm(), 'value': False,})
+ c = Context()
return render_to_response(template_name,
- context_instance = c)
+ {'form': ParticipantForm(), 'value': True,})