I found what I need in response from one of the links provided by Andre Miller.
I found out what can be passed to the HttpResponse iterator, so I used this code and it worked:
def import_iter():
""" Used to return output as it is generated """
t = loader.get_template('main/qimport.htm')
c = Context()
yield t.render(c)
if req.method == 'POST':
location = req.POST['location']
if location:
for finfo in import_location(location):
yield finfo+"<br/>"
return HttpResponse(import_iter())
source
share