def update_order(): if current_user is not None and current_user.is_privileged(UserType.staff): orderid = request.args.get("orderid", -1) if int(orderid) == -1: abort(404) elif int(orderid) == 0: abort(404) order = Orders.query.filter(Orders.orderid == orderid).first() if order is None: return render_template("error.html", message="查找不到与之匹配的订单") order.paytypename = PayType.getName(order.paytype) order.statusname = OrderStatus.getName(order.status) return render_template( "update_order.html", username=current_user.username, order=order, orderStatus=OrderStatus.getAll(), payTypes=PayType.getAll(), index=6, ) else: abort(403)
def register_course(): if current_user is not None and current_user.is_privileged(UserType.staff): cid = request.args.get("cid") username = request.args.get("username") course = Course.query.filter(Course.cid == cid).first() user = Users.query.filter(Users.username == username).first() if course is None: return render_template("error.html", message="查找不到与之匹配的课程") elif user is None: return render_template("error.html", message="查找不到与之匹配的用户") else: status = CourseStatus.getName(course.status) teacher = Teacher.query.filter(Teacher.tid == course.tid).first() allteachers = Teacher.query.order_by(Teacher.tid).all() return render_template( "register_course.html", username=current_user.username, course=course, pays=PayType.getAll() ) else: abort(403)