On 6/23/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote:

> I've read both previously to posting, but those don't seem to address my
> question of generating both a web page and a file at the same time of
> the latter after pressing a button in the former.
>


Ok, I *think* I understand your problem a bit better.

One thing you can do is store some information (filename, or
something) in the session object for the user. Then it doesn't matter
how long it takes for the user to press the button (unless of course
they wait days, and expire the cookie).

Another option is some simple AJAX stuff. So the original view loads
up. The HTML that was loaded has some JavaScript that causes an
XMLHTTPRequest to get sent to a different URL. That separate view can
then process, and generate the file, and return that file back. You
can then do some DOM manipulation to link to the file.

That's similar to what I did recently. I have a form that the user
enters data into, and presses "Submit". I then have to do some
rendering and generate a file, but that takes 30 seconds. So instead
of the page blocking on the Submit for 30 seconds, while waiting for
another view to complete, I immediately return a redirect to a new
page. That new page starts an XMLHTTPRequest, to start the file
generation.

Jay P.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to