summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/definingmodels.rst
diff options
context:
space:
mode:
authorMichael Merickel <github@m.merickel.org>2018-08-21 01:44:55 -0500
committerGitHub <noreply@github.com>2018-08-21 01:44:55 -0500
commit820a752645b460ea8009b07a75c752ab09c53dec (patch)
tree14616d81a7abedfe523c057e71ed7b2aca680754 /docs/tutorials/wiki2/definingmodels.rst
parentdf8598a2658632f709a64e8076cce02ca49de8e6 (diff)
parent254710cb716dccfe536b20d077e3cb79be19c6b3 (diff)
downloadpyramid-820a752645b460ea8009b07a75c752ab09c53dec.tar.gz
pyramid-820a752645b460ea8009b07a75c752ab09c53dec.tar.bz2
pyramid-820a752645b460ea8009b07a75c752ab09c53dec.zip
Merge pull request #3330 from stevepiercy/docs-code-style
Docs code style
Diffstat (limited to 'docs/tutorials/wiki2/definingmodels.rst')
-rw-r--r--docs/tutorials/wiki2/definingmodels.rst48
1 files changed, 24 insertions, 24 deletions
diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst
index c22fd2b61..9159027c4 100644
--- a/docs/tutorials/wiki2/definingmodels.rst
+++ b/docs/tutorials/wiki2/definingmodels.rst
@@ -32,9 +32,9 @@ parameter in the ``setup()`` function.
Open ``tutorial/setup.py`` and edit it to look like the following:
.. literalinclude:: src/models/setup.py
- :linenos:
- :emphasize-lines: 13
- :language: python
+ :linenos:
+ :emphasize-lines: 13
+ :language: python
Only the highlighted line needs to be added.
@@ -53,17 +53,17 @@ the newly added dependency distribution.
Make sure your current working directory is the root of the project (the
directory in which ``setup.py`` lives) and execute the following command.
-On UNIX:
+On Unix:
.. code-block:: bash
- $ $VENV/bin/pip install -e .
+ $VENV/bin/pip install -e .
On Windows:
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\pip install -e .
+ %VENV%\Scripts\pip install -e .
Success executing this command will end with a line to the console something
like the following.
@@ -86,8 +86,8 @@ Add ``user.py``
Create a new file ``tutorial/models/user.py`` with the following contents:
.. literalinclude:: src/models/tutorial/models/user.py
- :linenos:
- :language: py
+ :linenos:
+ :language: py
This is a very basic model for a user who can authenticate with our wiki.
@@ -125,8 +125,8 @@ Add ``page.py``
Create a new file ``tutorial/models/page.py`` with the following contents:
.. literalinclude:: src/models/tutorial/models/page.py
- :linenos:
- :language: py
+ :linenos:
+ :language: py
As you can see, our ``Page`` class is very similar to the ``User`` defined
above, except with attributes focused on storing information about a wiki page,
@@ -151,9 +151,9 @@ Open the ``tutorial/models/__init__.py`` file and edit it to look like
the following:
.. literalinclude:: src/models/tutorial/models/__init__.py
- :linenos:
- :language: py
- :emphasize-lines: 8,9
+ :linenos:
+ :language: py
+ :emphasize-lines: 8,9
Here we align our imports with the names of the models, ``Page`` and ``User``.
@@ -165,21 +165,21 @@ Migrate the database with Alembic
Now that we have written our models, we need to modify the database schema to reflect the changes to our code. Let's generate a new revision, then upgrade the database to the latest revision (head).
-On UNIX:
+On Unix:
.. code-block:: bash
- $ $VENV/bin/alembic -c development.ini revision --autogenerate \
- -m "use new models Page and User"
- $ $VENV/bin/alembic -c development.ini upgrade head
+ $VENV/bin/alembic -c development.ini revision --autogenerate \
+ -m "use new models Page and User"
+ $VENV/bin/alembic -c development.ini upgrade head
On Windows:
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\alembic -c development.ini revision \
- --autogenerate -m "use new models Page and User"
- c:\tutorial> %VENV%\Scripts\alembic -c development.ini upgrade head
+ %VENV%\Scripts\alembic -c development.ini revision \
+ --autogenerate -m "use new models Page and User"
+ %VENV%\Scripts\alembic -c development.ini upgrade head
Success executing these commands will generate output similar to the following.
@@ -308,9 +308,9 @@ Open ``tutorial/scripts/initialize_db.py`` and edit it to look like the
following:
.. literalinclude:: src/models/tutorial/scripts/initialize_db.py
- :linenos:
- :language: python
- :emphasize-lines: 11-24
+ :linenos:
+ :language: python
+ :emphasize-lines: 11-24
Only the highlighted lines need to be changed.
@@ -351,6 +351,6 @@ your console that ends with this exception:
.. code-block:: text
- AttributeError: module 'tutorial.models' has no attribute 'MyModel'
+ AttributeError: module 'tutorial.models' has no attribute 'MyModel'
This will also happen if you attempt to run the tests.