Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #39 from postatum/develop
Browse files Browse the repository at this point in the history
Update docs getting_started
  • Loading branch information
jstoiko committed May 15, 2015
2 parents 3b8c612 + 4869df5 commit 8e7a908
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Install nefertari and the database backend you want to use, e.g. sqla or mongodb
def main(global_config, **settings):
from .models import Item
config = Configurator(settings=settings)
config.include('nefertari.engine')
Expand All @@ -63,9 +62,11 @@ Install nefertari and the database backend you want to use, e.g. sqla or mongodb
root = config.get_root_resource()
from .models import Item
root.add(
'myitem', 'myitems',
id_name='myitem_' + Story.pk_field())
id_name='myitem_' + Item.pk_field(),
view='myproject.views.ItemsView')
# Use the engine helper to bootstrap the db
Expand Down Expand Up @@ -155,7 +156,7 @@ When using SQLA, each view must define the following properties:
Optional properties:
* *_json_encoder*: encoder to encode objects to JSON. Database-specific encoders are available at ``nefertari.engine.JSONEncoder``.

Your views should reside in a package and each module of that package should contain views for a particular root level route. In our example, the ``users`` route view must be at ``views.users.UsersView``.
Your views should reside in a package and each module of that package should contain views for a particular root level route. In our example, the ``users`` route view must be at ``views.users.UsersView``. Or you can explicitly provide view name, or view class as ``view`` keyword argument to ``resource.add()`` in your project's ``main`` function.

Note that in case of a singular resource (i.e. Likes), there is no "index" view and "show" returns only the one item.
Also, note that "delete", "update" and other actions that would normally require an id, do not in Nefertari, because there is only one object being referenced.
Expand Down

0 comments on commit 8e7a908

Please sign in to comment.