diff options
| author | Chris McDonough <chrism@plope.com> | 2015-11-04 12:42:50 -0800 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2015-11-04 12:42:50 -0800 |
| commit | 5cd91621668807f9b66811fe57a04fba96e7458a (patch) | |
| tree | f135aa39e3c3a5910c4eaf06764941470038b36a /docs/tutorials | |
| parent | 20d9350e61bc86e019c42b866c0b85cd274438bb (diff) | |
| parent | 5a7e26812a0afd18f6335641e799f6892c970fb5 (diff) | |
| download | pyramid-5cd91621668807f9b66811fe57a04fba96e7458a.tar.gz pyramid-5cd91621668807f9b66811fe57a04fba96e7458a.tar.bz2 pyramid-5cd91621668807f9b66811fe57a04fba96e7458a.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/tutorials')
| -rw-r--r-- | docs/tutorials/wiki2/basiclayout.rst | 5 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/src/basiclayout/tutorial/models.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index 623882516..80ae4b34e 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -204,7 +204,7 @@ Let's examine this in detail. First, we need some imports to support later code: Next we set up a SQLAlchemy ``DBSession`` object: .. literalinclude:: src/basiclayout/tutorial/models.py - :lines: 16 + :lines: 17 :language: py ``scoped_session`` and ``sessionmaker`` are standard SQLAlchemy helpers. @@ -247,5 +247,8 @@ The ``MyModel`` class has a ``__tablename__`` attribute. This informs SQLAlchemy which table to use to store the data representing instances of this class. +The Index import and the Index object creation is not required for this +tutorial, and will be removed in the next step. + That's about all there is to it regarding models, views, and initialization code in our stock application. diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py index 0cdd4bbc3..11ddccadb 100644 --- a/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py +++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py @@ -2,6 +2,7 @@ from sqlalchemy import ( Column, Integer, Text, + Index, ) from sqlalchemy.ext.declarative import declarative_base @@ -22,3 +23,5 @@ class MyModel(Base): id = Column(Integer, primary_key=True) name = Column(Text, unique=True) value = Column(Integer) + +Index('my_index', MyModel.name, unique=True, mysql_length=255) |
