Fixed views.py to accommodate form validation.
--- a/template/index.html Wed Sep 02 23:51:12 2009 +0530
+++ b/template/index.html Thu Sep 03 00:16:13 2009 +0530
@@ -38,7 +38,8 @@
<input type="submit" value="Upload" id="submit"/>
</form>
{% else %}
- Your Upload was successful!<br/>
+ Your Upload was successful!
+ You will be automatically redirected to the home page in 5 seconds<br/>
<script type="text/javascript"><!--
setTimeout('Redirect()',4000);
function Redirect()
--- a/upload/views.py Wed Sep 02 23:51:12 2009 +0530
+++ b/upload/views.py Thu Sep 03 00:16:13 2009 +0530
@@ -20,7 +20,9 @@
if form.is_valid():
#handle_uploaded_file(request.FILES['file'])
form.save()
- return render_to_response(template_name, {'form': ParticipantForm(), 'value': False,})
+ return render_to_response(template_name, {'form': form, 'value': False,})
+ else:
+ return render_to_response(template_name, {'form': form, 'value': True,})
c = Context()
return render_to_response(template_name,
{'form': ParticipantForm(), 'value': True,})