On Mon, 2008-03-03 at 14:27 -0800, bobhaugen wrote:
> Yet another n00b problem...I'm sure I got another stupid mistake in
> here, but can't see it.  Tried many variations.
> 
> I cut this down to a simple example that reproduces the problem (the
> real thing is a lot more complex), and only included the relevant
> details here.
> Running django-trunk on Ubuntu 7.10 using the development server and
> sqlite3.
> 
> # urls.py
> 
> urlpatterns = patterns('',
>     (r'^addorder/', add_order),
>     (r'^addorder/results/', results),
> )
> 
> # views.py
> 
> def add_order(request):
>     if request.method == 'POST':
>         form = OrderForm(request.POST)
>         if form.is_valid():
>             form.save()
>             return HttpResponseRedirect('results')
>     else:
>         form = OrderForm()
>     return render_to_response('orders/add_order.html', {'form': form})
> 
> def results(request):
>     return render_to_response('orders/results.html')
> 
> # add_order.html
> 
> {% block content %}
>     <form action="." method="POST" >
>         <table>
>             {{ form.as_table }}
>         </table>
>         <input type="submit" value="Submit Order" >
>     </form>
> {% endblock %}
> 
> # results.html
> 
> <html>
>     <head>
>         <title>Add Order Results</title>
>     </head>
>     <body>
>         <h1>Add Order Results go here.</h1>>
>     </body>
> </html>
> 
> No error messages. The order gets added.
> 
> But the results.html template never gets displayed.  The URL is
> http://127.0.0.1:8000/addorder/results but the template displayed is
> still add_order.html.
> 
> Terminal says:
> [03/Mar/2008 16:16:27] "GET /addorder/results HTTP/1.1" 200 898

This means you're not hitting the redirect line. The HTTP status code
for a redirect is 302, whereas this is showing a 200 response, which is
when you send back content.

It also says the request is a GET. So if this is the only thing that is
showing up, it means your POST is not being processed.

Malcolm

-- 
A clear conscience is usually the sign of a bad memory. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to