def POST(self, id): form = user_form() valid = form.validates() is_unique_username = not get_other_users(int(id), form.username.get_value()) if not valid or not is_unique_username: if not is_unique_username: form.username.note = u"%s已存在,请重新指定。" % ( form.username.get_value()) groups = get_groups() user = get_user_byid(id) user_groups = user.groups req = web.ctx.req req.update({ 'uid': user.id, 'form': form, 'groups': groups, 'user_groups': user_groups, }) return admin_render.user_edit(**req) data = web.input(groups=[]) form_data = form.d form_data.gids = data.groups save_user(int(id), form_data) raise web.seeother('/user/index')
def GET(self): form = user_form() groups = get_groups() req = web.ctx.req req.update({ 'form': form, 'groups': groups, 'user_groups': [], }) return admin_render.user_edit(**req)
def GET(self, id): form = user_form() user = get_user_byid(id) form.fill(user) groups = get_groups() user_groups = user.groups req = web.ctx.req req.update({ 'uid': user.id, 'form': form, 'groups': groups, 'user_groups': user_groups, }) return admin_render.user_edit(**req)
def POST(self): form = user_form() valid = form.validates() is_unique_username = get_user(form.username.get_value()) is None if not valid or not is_unique_username: if not is_unique_username: form.username.note = u"%s已存在,请重新指定。" % (form.username.get_value()) groups = get_groups() req = web.ctx.req req.update({ 'form': form, 'groups': groups, 'user_groups': [], }) return admin_render.user_edit(**req) data = web.input(groups=[]) form_data = form.d form_data.gids = data.groups save_user(-1, form_data) raise web.seeother('/user/index')
def POST(self): form = user_form() valid = form.validates() is_unique_username = get_user(form.username.get_value()) is None if not valid or not is_unique_username: if not is_unique_username: form.username.note = u"%s已存在,请重新指定。" % ( form.username.get_value()) groups = get_groups() req = web.ctx.req req.update({ 'form': form, 'groups': groups, 'user_groups': [], }) return admin_render.user_edit(**req) data = web.input(groups=[]) form_data = form.d form_data.gids = data.groups save_user(-1, form_data) raise web.seeother('/user/index')
def POST(self, id): form = user_form() valid = form.validates() is_unique_username = not get_other_users(int(id), form.username.get_value()) if not valid or not is_unique_username: if not is_unique_username: form.username.note = u"%s已存在,请重新指定。" % (form.username.get_value()) groups = get_groups() user = get_user_byid(id) user_groups = user.groups req = web.ctx.req req.update({ 'uid': user.id, 'form': form, 'groups': groups, 'user_groups': user_groups, }) return admin_render.user_edit(**req) data = web.input(groups=[]) form_data = form.d form_data.gids = data.groups save_user(int(id), form_data) raise web.seeother('/user/index')