Пример #1
0
def lecture_board_list(year, term, code, board_id):
    lecture = Lecture.get_lecture(year, term, code)
    boards = LectureBoard.objects(lecture_id=lecture.id)
    board = LectureBoard.objects(lecture_id=lecture.id, board_id=board_id).get()

    return render_template('module/lecture/detail/board.html', year=year, term=term, code=code,
                           lecture=lecture, boards=boards, board=board)
Пример #2
0
def lecture_board(year, term, code):
    lecture = Lecture.get_lecture(year, term, code)
    boards = LectureBoard.objects(lecture_id=lecture.id)
    if len(lecture.admins) < 1:
        return redirect(url_for('campus.lecture_auth_admin', year=year, term=term, code=code))

    if len(boards) < 1:
        return redirect(url_for('campus.lecture_admin_board', year=year, term=term, code=code))

    return redirect(url_for('campus.lecture_board_list', year=year, term=term, code=code, board_id=boards[0].board_id))
Пример #3
0
def lecture_admin_board_create(year, term, code):
    lecture = Lecture.get_lecture(year, term, code)

    try:
        board = LectureBoard.objects(lecture_id=lecture.id, board_id=request.form.get('board_id')).get()
    except LectureBoard.DoesNotExist:
        board = LectureBoard()

    board.lecture_id = lecture.id
    board.board_id = request.form.get('board_id')
    board.board_name = request.form.get('board_name')
    board.read_perm = request.form.get('read_perm')
    board.write_perm = request.form.get('write_perm')
    board.save()
    return jsonify({})
Пример #4
0
def lecture_admin_board(year, term, code):
    lecture = Lecture.get_lecture(year, term, code)
    return render_template('module/lecture/detail/admin/board.html', year=year, term=term, code=code,
                           lecture=lecture, boards=LectureBoard.objects(lecture_id=lecture.id))