On Mon, Jan 12, 2009 at 10:54 PM, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > > On Sun, 2009-01-11 at 19:27 -0800, stryderjzw wrote: >> Hi, >> >> Here's part of my code: >> >> class NewAssignmentFormPreview(FormPreview): >> >> def done(self, request, form): >> assignment = form.save(commit=False) >> assignment.save() >> >> ... >> >> return HttpResponseRedirect(assignment.get_absolute_url()) >> >> >> I do an HttpResponseRedirect to go to the assignment page after it's >> been created. >> >> However, when I do a refresh on that page, it still asks me if I want >> to submit POST data and an additional assignment is created. I thought >> HttpResponseRedirect is suppose to prevent that. > > Then either your browser is broken or you're not really hitting that > line of code. You could verify the latter case by inserting a syntax > error in the line (e.g. misspell "get_absolute_url") and make sure the > line is executed. > I discovered pdb some time ago and changed my life.
Insert, instead of the typo, this: import pdb pdb.set_trace() And hit refresh. Then go check in the development server, the execution of the script should have been frozen when hitting that line, and a prompt must be waiting for commands. For info type help. > Also, check this using the development server (or by looking at your web > server logs) and check that a request really is being sent to the server > from the browser after the redirect response is sent back. > > Regards, > Malcolm > >> >> Any ideas? >> >> Thanks! >> Justin >> > >> Regards, -- AlvAro --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---