Fixed #3005 -- Applied trivial docs patch for "oldforms" use of do_html2python.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4495 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0fabbf8ce8
commit
ffa0d27462
|
@ -173,10 +173,10 @@ creation view that takes validation into account::
|
||||||
|
|
||||||
# Check for validation errors
|
# Check for validation errors
|
||||||
errors = manipulator.get_validation_errors(new_data)
|
errors = manipulator.get_validation_errors(new_data)
|
||||||
|
manipulator.do_html2python(new_data)
|
||||||
if errors:
|
if errors:
|
||||||
return render_to_response('places/errors.html', {'errors': errors})
|
return render_to_response('places/errors.html', {'errors': errors})
|
||||||
else:
|
else:
|
||||||
manipulator.do_html2python(new_data)
|
|
||||||
new_place = manipulator.save(new_data)
|
new_place = manipulator.save(new_data)
|
||||||
return HttpResponse("Place created: %s" % new_place)
|
return HttpResponse("Place created: %s" % new_place)
|
||||||
|
|
||||||
|
@ -229,10 +229,10 @@ Below is the finished view::
|
||||||
|
|
||||||
# Check for errors.
|
# Check for errors.
|
||||||
errors = manipulator.get_validation_errors(new_data)
|
errors = manipulator.get_validation_errors(new_data)
|
||||||
|
manipulator.do_html2python(new_data)
|
||||||
|
|
||||||
if not errors:
|
if not errors:
|
||||||
# No errors. This means we can save the data!
|
# No errors. This means we can save the data!
|
||||||
manipulator.do_html2python(new_data)
|
|
||||||
new_place = manipulator.save(new_data)
|
new_place = manipulator.save(new_data)
|
||||||
|
|
||||||
# Redirect to the object's "edit" page. Always use a redirect
|
# Redirect to the object's "edit" page. Always use a redirect
|
||||||
|
@ -324,8 +324,8 @@ about editing an existing one? It's shockingly similar to creating a new one::
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
new_data = request.POST.copy()
|
new_data = request.POST.copy()
|
||||||
errors = manipulator.get_validation_errors(new_data)
|
errors = manipulator.get_validation_errors(new_data)
|
||||||
|
manipulator.do_html2python(new_data)
|
||||||
if not errors:
|
if not errors:
|
||||||
manipulator.do_html2python(new_data)
|
|
||||||
manipulator.save(new_data)
|
manipulator.save(new_data)
|
||||||
|
|
||||||
# Do a post-after-redirect so that reload works, etc.
|
# Do a post-after-redirect so that reload works, etc.
|
||||||
|
@ -406,8 +406,8 @@ Here's a simple function that might drive the above form::
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
new_data = request.POST.copy()
|
new_data = request.POST.copy()
|
||||||
errors = manipulator.get_validation_errors(new_data)
|
errors = manipulator.get_validation_errors(new_data)
|
||||||
|
manipulator.do_html2python(new_data)
|
||||||
if not errors:
|
if not errors:
|
||||||
manipulator.do_html2python(new_data)
|
|
||||||
|
|
||||||
# Send e-mail using new_data here...
|
# Send e-mail using new_data here...
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue