Exemplo n.º 1
0
 def GET(self):
     form = group_form()
     users = get_users()
     req = web.ctx.req
     req.update({
         'form': form,
         'users': users,
         'group_users': [],
         })
     return admin_render.group_edit(**req)
Exemplo n.º 2
0
 def GET(self):
     form = group_form()
     users = get_users()
     req = web.ctx.req
     req.update({
         'form': form,
         'users': users,
         'group_users': [],
     })
     return admin_render.group_edit(**req)
Exemplo n.º 3
0
 def GET(self, id):
     form = group_form()
     group = get_group_byid(id)
     form.fill(group)
     users = get_users()
     group_users = group.users
     req = web.ctx.req
     req.update({
         'form': form,
         'users': users,
         'group_users': group_users,
         })
     return admin_render.group_edit(**req)
Exemplo n.º 4
0
 def GET(self, id):
     form = group_form()
     group = get_group_byid(id)
     form.fill(group)
     users = get_users()
     group_users = group.users
     req = web.ctx.req
     req.update({
         'form': form,
         'users': users,
         'group_users': group_users,
     })
     return admin_render.group_edit(**req)
Exemplo n.º 5
0
 def POST(self):
     form = group_form()
     valid = form.validates()
     is_unique_name = get_group(form.name.get_value()) is None
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         users = get_users()
         req = web.ctx.req
         req.update({
             'form': form,
             'users': users,
             'group_users': [],
             })
         return admin_render.group_edit(**req)
     data = web.input(users=[])
     form_data = form.d
     form_data.uids = data.users
     save_group(-1, form_data)
     raise web.seeother('/group/index')
Exemplo n.º 6
0
 def POST(self):
     form = group_form()
     valid = form.validates()
     is_unique_name = get_group(form.name.get_value()) is None
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         users = get_users()
         req = web.ctx.req
         req.update({
             'form': form,
             'users': users,
             'group_users': [],
         })
         return admin_render.group_edit(**req)
     data = web.input(users=[])
     form_data = form.d
     form_data.uids = data.users
     save_group(-1, form_data)
     raise web.seeother('/group/index')
Exemplo n.º 7
0
 def POST(self, id):
     form = group_form()
     valid = form.validates()
     is_unique_name = not get_other_groups(int(id), form.name.get_value())
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         group = get_group_byid(id)
         form.fill(group)
         users = get_users()
         group_users = group.users
         req = web.ctx.req
         req.update({
             'form': form,
             'users': users,
             'group_users': group_users,
             })
         return admin_render.group_edit(**req)
     data = web.input(users=[])
     form_data = form.d
     form_data.uids = data.users
     save_group(int(id), form_data)
     raise web.seeother('/group/index')
Exemplo n.º 8
0
 def POST(self, id):
     form = group_form()
     valid = form.validates()
     is_unique_name = not get_other_groups(int(id), form.name.get_value())
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         group = get_group_byid(id)
         form.fill(group)
         users = get_users()
         group_users = group.users
         req = web.ctx.req
         req.update({
             'form': form,
             'users': users,
             'group_users': group_users,
         })
         return admin_render.group_edit(**req)
     data = web.input(users=[])
     form_data = form.d
     form_data.uids = data.users
     save_group(int(id), form_data)
     raise web.seeother('/group/index')