upload/views.py
changeset 2 4d2bbb2f3c4e
parent 1 6d3b60546075
child 3 eb11f0116216
equal deleted inserted replaced
1:6d3b60546075 2:4d2bbb2f3c4e
     1 #can add features like: supporting files with specified extensions, making edit box of content better etc.
     1 #can add features like: supporting files with specified extensions, making edit box of content better etc.
     2 from django.http import HttpResponse
     2 from django.http import HttpResponse
     3 from django.template import Context, Template
     3 from django.template import Context, Template
     4 from django.shortcuts import render_to_response
     4 from django.shortcuts import render_to_response
     5 from form import FileForm, Uploaded_fileForm
     5 from form import FileForm, Uploaded_fileForm
       
     6 from forms import ParticipantForm
     6 import tarfile
     7 import tarfile
     7 
     8 
     8 #function to read the upoaded file and store it
     9 #function to read the upoaded file and store it
     9 def handle_uploaded_file(f):
    10 def handle_uploaded_file(f):
    10     destination = open(f.name, 'wb+')
    11     destination = open(f.name, 'wb+')
    24 			'value': False,
    25 			'value': False,
    25 			}) 	    
    26 			}) 	    
    26 	    #display a page with textbox and all the content of file	   
    27 	    #display a page with textbox and all the content of file	   
    27             return render_to_response(template_name,
    28             return render_to_response(template_name,
    28 			context_instance = c)
    29 			context_instance = c)
    29     c = Context({'form': FileForm(),
    30     c = Context({'form': ParticipantForm(),
    30 		'value': True,
    31 		'value': True,
    31 		})
    32 		})
    32     return render_to_response(template_name,
    33     return render_to_response(template_name,
    33 			context_instance = c)
    34 			context_instance = c)
    34 
    35