>
>
> # urls.py
>
> urlpatterns = patterns('',
> (r'^addorder/', add_order),
> (r'^addorder/results/', results),
> )
Not 100% sure, but try adding a $ at the end of your regexes, to
indicate there's nothing after the url. Django now finds the
r'^addorder/' also for the url 'orders/results/', since it only
matches the start of the regex. So that url uses the 'add_order' view.
> # 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
>
> What am I doing wrong?
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---