From 92a1821598dc770874c8c4cd6f6356fc176ff838 Mon Sep 17 00:00:00 2001 From: Andrew Mleczko Date: Fri, 17 Jun 2011 12:48:34 +0200 Subject: [PATCH] add documentation --- docs/index.txt | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/index.txt b/docs/index.txt index 1e5c5f9..6e2683a 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -53,7 +53,7 @@ Custom view, factory, forms In the toward examples we just pass a ``package`` parameter to :func:`~pyramid_formalchemy.configure`. By default the function will try to -load ``package.models`` ``package.models.DBSession`` and ``package.forms`` but +load ``package.models``, ``package.models.DBSession`` and ``package.forms`` but you can override this. In this case you don't need to specify a package:: @@ -72,6 +72,32 @@ Having fun with the query_factory parameter .. literalinclude:: ../../formalchemy_project/__init__.py :pyobject: main +Custom views per model +---------------------- + +You can also register custom CRUD views per ModelListing:: + + + config.formalchemy_model_view('admin', + model='pyramidapp.models.Foo', + context='pyramid_formalchemy.resources.ModelListing', + renderer='templates/foolisting.pt', + attr='listing', + request_method='GET', + permission='view') + +and per Model:: + + + config.formalchemy_model_view('admin', + model='pyramidapp.models.Foo', + context='pyramid_formalchemy.resources.Model', + name='', + renderer='templates/fooshow.pt', + attr='show', + request_method='GET', + permission='view') + Setting permissions ===================