Skip to content

Commit

Permalink
Document rewrite (Basics Section)
Browse files Browse the repository at this point in the history
As I was going through the documentation, thought this section could use come clarification.
  • Loading branch information
Josh Finnie committed Feb 16, 2012
1 parent 1838fc6 commit 172d5fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -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
20 changes: 10 additions & 10 deletions docs/basics.rst
Expand Up @@ -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:
Expand All @@ -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.

Expand All @@ -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
Expand Down Expand Up @@ -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 172d5fe

Please sign in to comment.