Guest User

Untitled

a guest
Sep 10th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. # view
  2.  
  3. @view_config(route_name="user_form", renderer="admin/user.html")
  4. def user_form(request):
  5. w = widgets.UserForm
  6. w.fetch_data(request)
  7. mw = tw2.core.core.request_local()['middleware']
  8. mw.controllers.register(w.req(), 'user_submit')
  9. return {'widget': w}
  10.  
  11.  
  12. @view_config(route_name="user_grid", renderer="admin/user.html")
  13. def user_grid(request):
  14. w = widgets.UserGrid.req()
  15. mw = tw2.core.core.request_local()['middleware']
  16. mw.controllers.register(w, 'user_grid')
  17. return {'widget': w}
  18.  
  19.  
  20. # widgets
  21.  
  22. class UserForm(tw2.sqla.DbFormPage):
  23. entity = models.User
  24. #resources = [tw2.core.CSSLink(link='static/css/style.css')]
  25. redirect = '/admin/user/grid'
  26. title = 'User'
  27. class child(tw2.dynforms.CustomisedTableForm):
  28. action = '/tw2_controllers/user_submit'
  29. id = tw2.forms.HiddenField()
  30. username = tw2.forms.TextField(validator=tw2.core.Required)
  31. password = tw2.forms.TextField()
  32. groups = tw2.sqla.DbCheckBoxList(entity=models.Group)
  33. #class cast(tw2.dynforms.GrowingGridLayout):
  34. # character = tw2.forms.TextField()
  35. # actor = tw2.forms.TextField()
  36.  
  37.  
  38. class UserGrid(tw2.jqplugins.jqgrid.SQLAjqGridWidget):
  39. id = 'user_grid'
  40. entity = models.User
  41. excluded_columns = ['id', 'password', '_password']
  42. prmFilter = {'stringResult': True, 'searchOnEnter': False}
  43. pager_options = { "search" : False, "refresh" : True, "add" : False }
  44. options = {
  45. 'url': '/tw2_controllers/user_grid/',
  46. 'rowNum': 15,
  47. 'rowList':[15,30,50],
  48. 'viewrecords': True,
  49. 'imgpath': 'static/jqGrid/themes/green/images',
  50. 'width': 'auto',
  51. 'height': 'auto',
  52. }
Add Comment
Please, Sign In to add comment