Permalink
Browse files

Merge pull request #74 from joshfinnie/master

Rewrote "Rendering the Form" section for better flow.
  • Loading branch information...
mcdonc committed Feb 16, 2012
2 parents 1838fc6 + 172d5fe commit 4a2febb2a4a3f5b3ffcffe7ec35c3404b36fceb5
Showing with 11 additions and 10 deletions.
  1. +1 −0 CONTRIBUTORS.txt
  2. +10 −10 docs/basics.rst
View
@@ -109,3 +109,4 @@ Contributors
- Mathieu Le Marec - Pasquet , 2011/11/08
- Richard Mitchell, 2011/08/11
- Atsushi Odagiri, 2012/02/05
+- Josh Finnie, 2012/02/16
View
@@ -297,6 +297,14 @@ calling the :meth:`deform.Field.render` method: the
:class:`deform.Form` class is a subclass of the :class:`deform.Field`
class, so this method is available to a :class:`deform.Form` instance.
+If we wanted to render an "add" form (a form without initial
+data), we'd just omit the appstruct while calling
+:meth:`deform.Field.render`.
+
+.. code-block:: python
+
+ form = myform.render()
+
If we have some existing data already that we'd like to edit using the
form (the form is an "edit form" as opposed to an "add form"). That
data might look like this:
@@ -323,7 +331,7 @@ rendering:
form = myform.render(appstruct)
-If instead we wanted to render a "read-only" variant of an edit form
+If, finally, instead we wanted to render a "read-only" variant of an edit form
using the same appstruct, we'd pass the ``readonly`` flag as ``True``
to the :meth:`deform.Field.render` method.
@@ -334,14 +342,6 @@ to the :meth:`deform.Field.render` method.
This would cause a page to be rendered in a crude form without any
form controls, so the user it's presented to cannot edit it.
-If, finally, we wanted to render an "add" form (a form without initial
-data), we'd just omit the appstruct while calling
-:meth:`deform.Field.render`.
-
-.. code-block:: python
-
- form = myform.render()
-
Once any of the above statements runs, the ``form`` variable is now a
Unicode object containing an HTML rendering of the edit form, useful
for serving out to a browser. The root tag of the rendering will be
@@ -505,4 +505,4 @@ this chapter, visit
The application at http://deformdemo.repoze.org is a :mod:`pyramid`
application which demonstrates most of the features of Deform,
including most of the widget and data types available for use within
-an application that uses Deform.
+an application that uses Deform.

0 comments on commit 4a2febb

Please sign in to comment.