I have a problem that is causing me some grief and I can't seem to
found a reason for it. I'm relatively new to Django and Python so it is
likely to be something simple.
I have a function that displays a form and some data from a table. If
the form data is correct, it generates some new lines of data in the
table and displays another page. However, I get a Syntax error from my
render_to_response line in the function. Code is as follows in View.py:
def codeview(request):
manipulator = CodeViewManipulator()
if request.method == 'POST':
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:
<code to create data>
return HttpResponseRedirect("/hive/codeoutput/")
else:
errors = new_data = {}
code_list=CodeTest.objects.all()
return render_to_response('codeview.html', {'code_list':code_list})
This always generates a Django Syntax Error on the return
render_to_response line. I can define a new view with just the last two
lines and it works fine. The function also runs if I substitute a
return HttpResponse line instead of the render_to_response, but then it
won't display my html template page.
Is there some ruling preventing me from using render_to_response in
this way?
Any advice welcome - it's driving me crazy!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---