Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # view
- @view_config(route_name="user_form", renderer="admin/user.html")
- def user_form(request):
- w = widgets.UserForm
- w.fetch_data(request)
- mw = tw2.core.core.request_local()['middleware']
- mw.controllers.register(w.req(), 'user_submit')
- return {'widget': w}
- @view_config(route_name="user_grid", renderer="admin/user.html")
- def user_grid(request):
- w = widgets.UserGrid.req()
- mw = tw2.core.core.request_local()['middleware']
- mw.controllers.register(w, 'user_grid')
- return {'widget': w}
- # widgets
- class UserForm(tw2.sqla.DbFormPage):
- entity = models.User
- #resources = [tw2.core.CSSLink(link='static/css/style.css')]
- redirect = '/admin/user/grid'
- title = 'User'
- class child(tw2.dynforms.CustomisedTableForm):
- action = '/tw2_controllers/user_submit'
- id = tw2.forms.HiddenField()
- username = tw2.forms.TextField(validator=tw2.core.Required)
- password = tw2.forms.TextField()
- groups = tw2.sqla.DbCheckBoxList(entity=models.Group)
- #class cast(tw2.dynforms.GrowingGridLayout):
- # character = tw2.forms.TextField()
- # actor = tw2.forms.TextField()
- class UserGrid(tw2.jqplugins.jqgrid.SQLAjqGridWidget):
- id = 'user_grid'
- entity = models.User
- excluded_columns = ['id', 'password', '_password']
- prmFilter = {'stringResult': True, 'searchOnEnter': False}
- pager_options = { "search" : False, "refresh" : True, "add" : False }
- options = {
- 'url': '/tw2_controllers/user_grid/',
- 'rowNum': 15,
- 'rowList':[15,30,50],
- 'viewrecords': True,
- 'imgpath': 'static/jqGrid/themes/green/images',
- 'width': 'auto',
- 'height': 'auto',
- }
Add Comment
Please, Sign In to add comment