Beispiel #1
0
def run(args, db):
    from db import Student, TranscriptEntry as Entry

    id = args.student
    if id.startswith('0') or id.startswith('2'):
        s = Student.get(student_id=int(id))
    else:
        s = Student.get(username=id)

    print('%-20s  %09d  %s' % (s.name(), s.student_id, s.email()))

    for e in Entry.select().where(Entry.student == s.student_id).order_by(Entry.year, Entry.term):
        if e.mark is None:
            continue

        print('%4s %-4s    %04d%02d %3d' % (
            e.subject, e.code, e.year, e.term, e.mark))
Beispiel #2
0
def rm():
    try:
        pk = int(request.args.get('id'))
        
        student = Student.get(id=pk)
        student.delete_instance()
        flash("%s 已删除" % student.name)
    except Exception as e:
        flash(str(e))

    return redirect(url_for('index'))
Beispiel #3
0
def deleting_students(id):
    s = Student.get(Student.id == id)
    s.delete_instance()
    return redirect(url_for('home'))