summaryrefslogtreecommitdiff
path: root/docs/forms.txt
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2006-09-14 13:31:50 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2006-09-14 13:31:50 +0000
commit45399b4b13928e7616d4d1b2e8859d6ef9a865c7 (patch)
tree0037309db9431bcb08add387cd53ea7bc10d88fe /docs/forms.txt
parent3c5782287efc197eccf556cf6915fc0d8b3e02bd (diff)
Updated documentation for ChangeManipulators to reflect use of flatten_data() rather than __dict__ to populate form data.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3758 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/forms.txt')
-rw-r--r--docs/forms.txt10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/forms.txt b/docs/forms.txt
index 67408f3c5d..d6ef6f791b 100644
--- a/docs/forms.txt
+++ b/docs/forms.txt
@@ -321,7 +321,7 @@ about editing an existing one? It's shockingly similar to creating a new one::
else:
errors = {}
# This makes sure the form accurate represents the fields of the place.
- new_data = place.__dict__
+ new_data = manipulator.flatten_data()
form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('places/edit_form.html', {'form': form, 'place': place})
@@ -336,10 +336,10 @@ The only real differences are:
* ``ChangeManipulator.original_object`` stores the instance of the
object being edited.
- * We set ``new_data`` to the original object's ``__dict__``. This makes
- sure the form fields contain the current values of the object.
- ``FormWrapper`` does not modify ``new_data`` in any way, and templates
- cannot, so this is perfectly safe.
+ * We set ``new_data`` based upon ``flatten_data()`` from the manipulator.
+ ``flatten_data()`` takes the data from the original object under
+ manipulation, and converts it into a data dictionary that can be used
+ to populate form elements with the existing values for the object.
* The above example uses a different template, so create and edit can be
"skinned" differently if needed, but the form chunk itself is completely