Configuration

Initialize

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from .models import (Model1, Model2, Model3,)

# add SQLAlchemy backend
config.include('ps_alchemy')

# add pyramid_sacrud and project models
config.include('pyramid_sacrud')
settings = config.registry.settings
settings['pyramid_sacrud.models'] = (
    ('Group1', [Model1, Model2]),
    ('Group2', [Model3])
)

check it there http://localhost:6543/sacrud/

Set another prefix

config.include('pyramid_sacrud', route_prefix='admin')

now it there http://localhost:6543/admin/

Template redefinition

pyramid_sacrud use Jinja2 template renderer. Just create template file in your project templates/sacrud directory:

yourapp/
└── templates
    └── sacrud
          └── home.jinja2  <-- custom template for pyramid_sacrud home page

You can find a list of all the templates here https://github.com/sacrud/pyramid_sacrud/tree/master/pyramid_sacrud/templates/sacrud

Translate widget name

See also

For more information see Internationalization and Localization


To translate widgets on main page, you can use standard translate method for Pyramid.

from pyramid.i18n import TranslationStringFactory

_ = TranslationStringFactory('myapplication')
settings['pyramid_sacrud.models'] = (
    (_('Permissions'), (
            UserPermission,
            UserGroup,
            Group,
            GroupPermission,
            Resource,
            UserResourcePermission,
            GroupResourcePermission,
            ExternalIdentity,
        )
    ),
    (_('Users'), (User, Staff))
)
  Read the Docs
v: latest  
Versions
latest
stable
master
Free document hosting provided by Read the Docs.