Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated documentation for ChangeManipulators to reflect use of flatte…

…n_data() rather than __dict__ to populate form data.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3758 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 45399b4b13928e7616d4d1b2e8859d6ef9a865c7 1 parent 3c57822
Russell Keith-Magee authored September 14, 2006

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  docs/forms.txt
10  docs/forms.txt
@@ -321,7 +321,7 @@ about editing an existing one? It's shockingly similar to creating a new one::
321 321
         else:
322 322
             errors = {}
323 323
             # This makes sure the form accurate represents the fields of the place.
324  
-            new_data = place.__dict__
  324
+            new_data = manipulator.flatten_data()
325 325
 
326 326
         form = forms.FormWrapper(manipulator, new_data, errors)
327 327
         return render_to_response('places/edit_form.html', {'form': form, 'place': place})
@@ -336,10 +336,10 @@ The only real differences are:
336 336
     * ``ChangeManipulator.original_object`` stores the instance of the
337 337
       object being edited.
338 338
 
339  
-    * We set ``new_data`` to the original object's ``__dict__``. This makes
340  
-      sure the form fields contain the current values of the object.
341  
-      ``FormWrapper`` does not modify ``new_data`` in any way, and templates
342  
-      cannot, so this is perfectly safe.
  339
+    * We set ``new_data`` based upon ``flatten_data()`` from the manipulator.
  340
+      ``flatten_data()`` takes the data from the original object under 
  341
+      manipulation, and converts it into a data dictionary that can be used 
  342
+      to populate form elements with the existing values for the object.
343 343
 
344 344
     * The above example uses a different template, so create and edit can be
345 345
       "skinned" differently if needed, but the form chunk itself is completely

0 notes on commit 45399b4

Please sign in to comment.
Something went wrong with that request. Please try again.