Rolando's suggestion is a pretty straight forward method to achieve what you
want. You probably need to elaborate where in the process you're having
trouble (although based on your response maybe it's the first step?). You
can indeed call a view.my function from your please wait template, but you
want to do it in the background, i.e., with an AJAX request in order to keep
the Please Wait message displayed while your server processes the request.

On Tue, Aug 31, 2010 at 2:46 PM, Bradley Hintze <bradle...@aggiemail.usu.edu
> wrote:

> I'm getting no where with this, are there any other suggestions on row
> to render a 'please wait' page while other python works? Can I call a
> view.my function to run from my 'please wait' template?
>
> Please be as elementary as possible as javascript, AJAX, jquery, and
> the like are brand new to me.
>
> Thanks,
> Bradley
>
> On Tue, Aug 31, 2010 at 10:38 AM, Bradley Hintze
> <bradle...@aggiemail.usu.edu> wrote:
> > I'll look into this. I have no idea what you mean by 'ajax' or 'json'.
> > Thus your code doe'snt really make sense given my lack of knowlege. I
> > will do some googling to see if I can piece it together. Thanks for
> > the help!
> >
> > On Mon, Aug 30, 2010 at 10:37 PM, Rolando Espinoza La Fuente
> > <dark...@gmail.com> wrote:
> >> On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze
> >> <bradle...@aggiemail.usu.edu> wrote:
> >>> I am attempting to do a lengthe calculation that will require the user
> >>> to wait a bit. I want a 'Please wait page to come up while the lengthy
> >>> calculation is performed. I thought this might work:
> >>>
> >>> views.py
> >>>
> >>> def please_wait(request):
> >>>    return HttpResponse('Please Wait......')
> >>>
> >>> def run_DHM(request):
> >>>    please_wait(request)
> >>>    ....lengthy calculations...
> >>>
> >>> This did not show the 'Please Wait' page. Is there a better way to do
> >>> what I am trying to do?
> >>>
> >>
> >> You are not returning the HttpResponse object from please_wait(). But
> anyway,
> >> doesn't work that way. At least with django.
> >>
> >> What you can do is render a normal html with the message "Please wait",
> >> then perform an ajax call to start the calculations and finally return
> >> a json response
> >> to display the result in the client-side.
> >>
> >> Roughly:
> >>
> >> def please_wait(request):
> >>    # ... setup context or something
> >>    return render_to_response("please_wait.html")
> >>
> >> def run_DHM(request)
> >>    # ... perform calculations and collect the result in a dict
> >>    data = {"result": something}
> >>    return HttpResponse(json.dumps(data), mimetype="application/json")
> >>
> >>
> >> # using jquery in your html
> >> <script type="text/javascript">
> >> $.getJSON("/run_DHM/", function(data) {
> >>    // do something with result
> >>    console.log(data.result);
> >> });
> >> </script>
> >>
> >>
> >> Rolando Espinoza La fuente
> >> www.insophia.com
> >>
> >>> --
> >>> Bradley J. Hintze
> >>> Graduate Student
> >>> Duke University
> >>> School of Medicine
> >>> 801-712-8799
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> >>> To post to this group, send email to django-us...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> >>> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >>>
> >>>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> >> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >>
> >>
> >
> >
> >
> > --
> > Bradley J. Hintze
> > Graduate Student
> > Duke University
> > School of Medicine
> > 801-712-8799
> >
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to