summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/basiclayout.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2013-09-06 20:41:18 -0700
committerMichael Merickel <michael@merickel.org>2013-09-06 20:41:18 -0700
commit1bd339e1b3c09ff62e1cd15623815448ab091d2a (patch)
treee33a463d358251ceae9e6fcf3d995dca7e095c8a /docs/tutorials/wiki2/basiclayout.rst
parent90b9686a20e6465b9a97ce02e4d10080c0cf271e (diff)
parent24ac1ff6b4fbed346c18c759790ae1656a5fdcb3 (diff)
downloadpyramid-1bd339e1b3c09ff62e1cd15623815448ab091d2a.tar.gz
pyramid-1bd339e1b3c09ff62e1cd15623815448ab091d2a.tar.bz2
pyramid-1bd339e1b3c09ff62e1cd15623815448ab091d2a.zip
Merge pull request #1115 from bertjwregeer/docs/remove_init_sqlalchemy
Docs: remove init sqlalchemy
Diffstat (limited to 'docs/tutorials/wiki2/basiclayout.rst')
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst
index 0193afab4..1f3d630c7 100644
--- a/docs/tutorials/wiki2/basiclayout.rst
+++ b/docs/tutorials/wiki2/basiclayout.rst
@@ -225,10 +225,17 @@ To give a simple example of a model class, we define one named ``MyModel``:
:linenos:
:language: py
-Our example model has an ``__init__`` method that takes two arguments
-(``name``, and ``value``). It stores these values as ``self.name`` and
-``self.value`` on the instance created by the ``__init__`` function itself.
-The ``MyModel`` class also has a ``__tablename__`` attribute. This informs
+Our example model does not require an ``__init__`` method because SQLAlchemy
+supplies for us a default constructor if one is not already present,
+which accepts keyword arguments of the same name as that of the mapped attributes.
+
+.. note:: Example usage of MyModel:
+
+ .. code-block:: python
+
+ johnny = MyModel(name="John Doe", value=10)
+
+The ``MyModel`` class has a ``__tablename__`` attribute. This informs
SQLAlchemy which table to use to store the data representing instances of this
class.