def manage_apply(): if not current_user.is_admin and not current_user.is_coach: return redirect(url_for('main.index')) apply_users = list() if current_user.is_admin: apply_users = user_server.get_list(limit=-1, isApply=True) elif current_user.is_coach: apply_users = user_server.get_list(limit=-1, school=current_user.school, isApply=True) return render_template('manage_apply.html', title = u'新生申请验证', apply_users = apply_users, SCHOOL_MAP = config.SCHOOL_MAP, COLLEGE_MAP = config.SCHOOL_COLLEGE_MAP)
def get_user_list(): if not current_user.is_admin and not current_user.is_coach: return redirect(url_for('index')) offset = request.form.get('offset') limit = request.form.get('limit') users = list() sum = 0 if current_user.is_admin: users = user_server.get_list(offset, limit) sum = user_server.get_count() elif current_user.is_coach: users = user_server.get_list(offset, limit, school=current_user.school) sum = user_server.get_count(school=current_user.school) return jsonify(user_list=[get_user_list_item(user) for user in users], sum=sum, offset=int(offset), limit=len(users))
def manage_apply(): if not current_user.is_admin and not current_user.is_coach: return redirect(url_for('main.index')) apply_users = list() if current_user.is_admin: apply_users = user_server.get_list(limit=-1, isApply=True) elif current_user.is_coach: apply_users = user_server.get_list(limit=-1, school=current_user.school, isApply=True) return render_template('manage_apply.html', title=u'新生申请验证', apply_users=apply_users, SCHOOL_MAP=config.SCHOOL_MAP, COLLEGE_MAP=config.SCHOOL_COLLEGE_MAP)
def members(): all_users = user_server.get_list(limit=-1) users = [] for user in all_users: if user.is_student: users.append({ 'name': user.name, 'college': SCHOOL_COLLEGE_MAP[user.college] if user.college else '', 'grade': user.grade + u'级' if user.grade else '', 'situation': user.situation }) return json.dumps({ 'data': users })