Re: Please wait page trouble

2010-09-10 Thread Alec Shaner
Excellent. Glad you got it working. On Fri, Sep 10, 2010 at 8:54 AM, Bradley Hintze wrote: > I got to work! I needed a good nights sleep to see it. the url was > '/DHM_run/' NOT '/run_DHM/'. > > Thanks Alec > > -- You received this message because you are subscribed to the Google Groups "Djan

Re: Please wait page trouble

2010-09-10 Thread Bradley Hintze
I got to work! I needed a good nights sleep to see it. the url was '/DHM_run/' NOT '/run_DHM/'. Thanks Alec On Thu, Sep 9, 2010 at 4:20 PM, Bradley Hintze wrote: > Ok, cant quite get it. Here is what I have: > > please_wait.html > ... > src="Re: Please wait page trouble
Ok, cant quite get it. Here is what I have: please_wait.html ... http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";> $.get({{ calculation_url }}, function(data) { if (data == 'OK') { window.location.href = {{ view_url }}; } else { alert(data); }

Re: Please wait page trouble

A lot of ways to do this. Yes you could do it as above, but that can get ugly as you start adding more views. You can indeed access the context dictionary in please_wait.html. It's hard to say without knowing more details about your application. How does the user pass arguments (if any) used in the

Re: Please wait page trouble

OK, Got it working. Sorry one more question. I have a couple of places where I'd like to display the 'Please Wait' page. I'd imagine I'd do something similar to the following:: # please_wait.html ... http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";> if (If_come_from_pageA)

Re: Please wait page trouble

Yeah, I just tried out what I wrote in my last and it worked! Thanks for all your help!!! Bradley On Thu, Sep 9, 2010 at 11:17 AM, Alec Shaner wrote: > That's really a design issue up to you, i.e., how you get data from your > view to your template. Since I don't know the format or how much dat

Re: Please wait page trouble

That's really a design issue up to you, i.e., how you get data from your view to your template. Since I don't know the format or how much data you're storing in the session it's hard to say. I was just assuming you'd use context variable(s) to pass the data to the template. I'm not intimately famil

Re: Please wait page trouble

Thanks Alec, That finally makes sense. However, I do have a question here: def display_DHM(request): # Get results from session return render_to_response('ran_DHM.html', ...) '# Get results from session' Would I not just do this: def display_DHM(request): return render_to_respon

Re: Please wait page trouble

The NoReverseMatch error is being thrown because Django cannot find a named URL pattern to match {% url run_DHM %}. Here is the link to the spot in the docs where it discusses this feature: http://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns In essence, you would need to re

Re: Please wait page trouble

I feel your pain - javascript has always been a pain for me, but libraries like jQuery make it more bearable! AJAX calls are made in the background (usually asynchronously), so they don't directly change the page you're currently viewing in your browser. The browser is responsible for dispatching

Re: Please wait page trouble

Alec, Thanks for your patience. The jquery tutorials have been frustrating. Anyway, I do not have three 'views' as you suggested. I will try that. But I need to understand a few things before I try that. How to call run_DHM from my please_wait.html page. (I assume AJAX but I've tried and tries wha

Re: Please wait page trouble

Could you post the full url.py file? And as Brian mentioned your javascript block should be separated. Plus you have an extra }); that's going to fail once you resolve this reverse error. It's also not clear what you intend to happen when run_DHM returns its response? It looks like your intent is

Re: Please wait page trouble

#url.py ... (r'^please_wait/', please_wait), (r'^DHM_run/$', run_DHM), ... #please_wait.html http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";> $.getJSON('{% url run_DHM %}') }); #view.py def please_wait(request): c = {'we_r_home':'yes'} return render_to_respon

Re: Please wait page trouble

On Sep 8, 5:56 pm, Bradley Hintze wrote: > This is what I have in my please_wait.html > > src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";> > $.getJSON('{% url run_DHM %}')}); > > I

Re: Please wait page trouble

Do you have it in the urls.py file? Would be best to paste it into pastebin or here if it's few lines only zalun On 09/08/10 23:56, Bradley Hintze wrote: > This is what I have in my please_wait.html > > src="

Re: Please wait page trouble

This is what I have in my please_wait.html http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";> $.getJSON('{% url run_DHM %}') }); This is the django error Caught NoReverseMatch while rendering: Reverse for 'run_DHM' with arguments '()' and keyword arguments '{}' not found. run

Re: Please wait page trouble

You need to include the jquery library script in your html page if you're calling getJSON as in the previous emails (and note that getJSON isn't necessarily the function you want - jquery provides many options for doing AJAX). Either download it, or use one of the public repositories: http://docs.

Re: Please wait page trouble

It seems as if this is the only solution but after a week of trying to implement it in a variety of ways it won't work. is there something I need to download (jquery)? More helpful would be a real HTML page as an example or a live example on the web. I am sorry for the trouble but I'd like to under

Re: Please wait page trouble

$.getJSON should be embedded in your initial Page Wait response page. The first argument isn't a view, rather a URL. So you might want to use the django url template tag, e.g., $.getJSON('{% url whatever.run_DHM %}', ...) The second argument is a callback function. The browser stores the callback

Re: Please wait page trouble

Ok, I'll try to elaborate. again java is foreign to me although I've spent all day trying to learn some. Here's the code: def please_wait(request): # ... setup context or something return render_to_response("please_wait.html") def run_DHM(request) # ... perform calculations and collect

Re: Please wait page trouble

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 w

Re: Please wait page trouble

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. T

Re: Please wait page trouble

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 wrote: > On Mon,

Re: Please wait page trouble

On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze 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):

Please wait page trouble

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):