Reputation: 9956
I posted a question earlier about why django redirect was not working correctly, but quickly remove it because I discovered the when I took jquery mobile out of the equation, django is working fine.
I have a form which I am submiting and varifying in django in the usual manner. This is working fine. The problem comes when after the form is submited I want to redirect to a different url.
When I do this without jquery mobile, I simply user:
response("myurl")
which works fine, but When I use jquery mobile I am redirected to the correct page, but the browser url does not change.
This causes all manner of problems because I am using variables in my django url regex, and without the correct url nothing works correctly.
Has anyone else had a similar problem when using jquery mobile and django together? If so what did you do about it? Failing that, can anyone shed any light on why this is happening?
Upvotes: 1
Views: 1122
Reputation: 9956
After a lot of goggling I ended up back at a question on stackoverflow which I had not spotted as it was only tagged as a jquery question and did not mention django in the title either.
error-with-redirects-in-jquery-mobile
This suggests specifying data-url to set the url.
In my websites base template file I setup the data-url with a code block marker like this:
<div id="page" name="page" data-role="page" data-url="{% block data-url %}/root/{% endblock %}" class="type-interior">
then in the individual page templates I am then able to set to specify the url like this:
{% block data-url %}/root/myurl/{% endblock %}">
I am not sure if this is the optimal solution as of course this means that I have to include the data-url block in every template, but it does work
Upvotes: 2