Hello,

I have a "Cancel" button on one of my Webpages. The button sometimes
works as expected, sometimes it does not. After the button has been
clicked, it is supposed that the webpage is re-directed to another
page. However, this re-direction seems not work all the time.
Following is my script.

In my urls.py:

....
 (r'^cancel/$', cancel),
.....

In my view.py:

def save_view(request):

    if request.POST:
        action = request.POST['action']

        if action == 'Cancel':
            url = '/cancel/'
#            this_url = reverse('cancel')
#            return HttpResponseRedirect(this_url)
            return HttpResponseRedirect(url)

And my "cancel" view is really simple. It is

def cancel(request):
        return render_to_response('cancel.html')


I even tried "reverse", however problem did not get fixed. (see the
commented code).

Anybody knows how to fix this?

Thanks so much.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to