diff options
| author | Chris McDonough <chrism@plope.com> | 2013-03-23 03:08:04 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-03-23 03:08:04 -0400 |
| commit | e34541a752384e5fa432c2b14003211dc11f223a (patch) | |
| tree | 132794de4f52160d99586d91701880ebb6f9ddcd /docs/tutorials/wiki2/definingmodels.rst | |
| parent | 35d88c65d7b4ca7c75c3cf767be040ff9e0253f9 (diff) | |
| parent | 79112298e7cb27ee2d80e85429969cb005c31066 (diff) | |
| download | pyramid-e34541a752384e5fa432c2b14003211dc11f223a.tar.gz pyramid-e34541a752384e5fa432c2b14003211dc11f223a.tar.bz2 pyramid-e34541a752384e5fa432c2b14003211dc11f223a.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/tutorials/wiki2/definingmodels.rst')
| -rw-r--r-- | docs/tutorials/wiki2/definingmodels.rst | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst index dca6238dd..60427a911 100644 --- a/docs/tutorials/wiki2/definingmodels.rst +++ b/docs/tutorials/wiki2/definingmodels.rst @@ -6,9 +6,6 @@ The first change we'll make to our stock ``pcreate``-generated application will be to define a :term:`domain model` constructor representing a wiki page. We'll do this inside our ``models.py`` file. -The source code for this tutorial stage can be browsed at -`http://github.com/Pylons/pyramid/tree/1.3-branch/docs/tutorials/wiki2/src/models/ -<http://github.com/Pylons/pyramid/tree/1.3-branch/docs/tutorials/wiki2/src/models/>`_. Making Edits to ``models.py`` ----------------------------- @@ -37,7 +34,7 @@ sample and we're not going to use it. Then, we added a ``Page`` class. Because this is a SQLAlchemy application, this class inherits from an instance of -:class:`sqlalchemy.ext.declarative.declarative_base`. +:func:`sqlalchemy.ext.declarative.declarative_base`. .. literalinclude:: src/models/tutorial/models.py :pyobject: Page @@ -48,9 +45,10 @@ As you can see, our ``Page`` class has a class level attribute ``__tablename__`` which equals the string ``'pages'``. This means that SQLAlchemy will store our wiki data in a SQL table named ``pages``. Our ``Page`` class will also have class-level attributes named ``id``, ``name`` and -``data`` (all instances of :class:`sqlalchemy.Column`). These will map to -columns in the ``pages`` table. The ``id`` attribute will be the primary key -in the table. The ``name`` attribute will be a text attribute, each value of +``data`` (all instances of :class:`sqlalchemy.schema.Column`). +These will map to columns in the ``pages`` table. +The ``id`` attribute will be the primary key in the table. +The ``name`` attribute will be a text attribute, each value of which needs to be unique within the column. The ``data`` attribute is a text attribute that will hold the body of each page. @@ -80,8 +78,6 @@ following: Installing the Project and re-initializing the Database ------------------------------------------------------- -Redo the steps in :ref:`installing_project_in_dev_mode`. - Because our model has changed, in order to reinitialize the database, we need to rerun the ``initialize_tutorial_db`` command to pick up the changes you've made to both the models.py file and to the initializedb.py file. |
