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 to do a redirect and run_DHM will use session data to retrieve calculation results.
Just to clarify, I think your plan is to:
1. Display a Please Wait page that fires off an AJAX call to some view that performs calculations => run_DHM. The results of the calculations are stored in the session.
2. run_DHM returns a simple response that will indicate sucess, e.g., "OK"
3. Redirect to a view to display the results, which are retrieved from the session => display_DHM
I think you need three views here: please_wait, run_DHM, and display_DHM.
On Thu, Sep 9, 2010 at 8:45 AM, Bradley Hintze <bradley.h@aggiemail.usu.edu> wrote:
#url.py
...
(r'^please_wait/', please_wait),
(r'^DHM_run/$', run_DHM),
...
#please_wait.html
#view.py
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">
$.getJSON('{% url run_DHM %}')
});
</script>
def please_wait(request):
c = {'we_r_home':'yes'}
return render_to_response('please_wait.html', c)
def run_DHM(request):
//put calculated data in request.session
return render_to_response('DHM_ran.html', request.session,
context_instance=RequestContext(request))
Bradley
This is the django error
Caught NoReverseMatch while rendering: Reverse for 'run_DHM' with
arguments '()' and keyword arguments '{}' not found.
run_DHM takes 'request' as an argument. How do I pass it the argument??
--
On Wed, Sep 8, 2010 at 9:34 PM, Brian Neal <bgneal@gmail.com> wrote:
> On Sep 8, 5:56 pm, Bradley Hintze <bradle...@aggiemail.usu.edu> wrote:
>> This is what I have in my please_wait.html
>>
>> <script type="text/javascript"
>> src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">
>> $.getJSON('{% url run_DHM %}')});
>>
>> </script>
>
> I don't think that is right, is it? At least I've never seen it done
> that way. I think you need two script tags:
>
> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/
> libs/jquery/1.4/jquery.min.js"></script>
> <script type="text/javascript">
> // Your javascript goes here...
> </script>
>
>>
>> This is the django error
>>
>> Caught NoReverseMatch while rendering: Reverse for 'run_DHM' with
>> arguments '()' and keyword arguments '{}' not found.
>>
>> run_DHM takes 'request' as an argument. How do I pass it the argument??
>>
>
> All views take request as a first argument. But that isn't the
> problem. Please post your urls.py that has your run_DHM view in it.
>
> Regards,
> BN
>
> --
> 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 django-users+unsubscribe@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
--
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 django-users+unsubscribe@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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment