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
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
-~----------~----~----~----~------~----~------~--~---