예제 #1
0
    def post(self, student_id=None):
        student = StudentModel()
        form = StudentForm()
        if student_id == None:
            if form.validate_on_submit():
                form.populate_obj(student)
                db_session.add(student)
                db_session.commit()
                return redirect('student_test')
        else:
            if form.validate_on_submit():
                student_by_id = student.query.get(student_id) 
                
                student_by_id.studentUid = form.studentUid.data
                student_by_id.nameLast = form.nameLast.data
                student_by_id.nameFirst = form.nameFirst.data
                student_by_id.email = form.email.data
                student_by_id.phone = form.phone.data
                student_by_id.major = form.major.data
                student_by_id.programCode = form.programCode.data
                student_by_id.semBegin = form.semBegin.data
                student_by_id.graduationExpected = form.graduationExpected.data
                student_by_id.creditFall = form.creditFall.data
                student_by_id.creditSpring = form.creditSpring.data 
                student_by_id.request201408 = form.request201408.data
                student_by_id.request201501 = form.request201501.data
                db_session.commit()
                return redirect('student_test')

        return redirect('/')
예제 #2
0
 def post(self):
     "create position record"
     position = PostionModel()
     form = PositionForm()
     if form.validate():
         position(
         form.position_id.data,
         form.title.data,
         form.workGroup.data,
         form.position_type.data,
         form.course.data,
         form.programMin.data,
         form.programStd.data,
         form.positionOverview.data,
         form.primaryDuties.data,
         form.necessarySkill.data,
         form.preferredSkill.data,
         form.dateOpen.data,
         form.dateClosed.data,
         form.available.data,
         form.supervisor_id.data
         )
         return position
         db_session.add(position)
         bd_session.commit()
예제 #3
0
 def post(self):
     "create new student record, http://flask.pocoo.org/snippets/63/ for easy WTforms redirect"
     student = StudentModel()
     form = StudentForm()
     if form.validate_on_submit():
         form.populate_obj(student)
         '''student = StudentModel(
         None,
         form.studentUid.data,
         form.nameLast.data,
         form.nameFirst.data,
         form.email.data,
         form.phone.data,
         form.major.data,
         form.programCode.data,
         form.semBegin.data,
         form.graduationExpected.data,
         form.creditFall.data,
         form.creditSpring.data, 
         form.request201408.data,
         form.request201501.data
             )'''
         db_session.add(student)
         db_session.commit()
         return redirect('/')
         
         
     return render_template('student_review.html', student_list=student, form=form)
예제 #4
0
 def post(self, position_id):
     "create application record"
     applications = ApplicationModel()
     form = ApplicationForm(request.form)
     if form.validate():
         applications(form.app_id.data,
         form.student_id.data,
         form.position_id.data
         )
         return application
         db_session.add(application)
         db_session.commit()
예제 #5
0
 def post(self):
     "create supervisor record"
     supervisor = SupervisorModel()
     form = SupervisorForm()
     if form.validate():
        supervisor(
        10,
        form.nameLast.data,
        form.nameFirst.data,
        form.phone.data,
        form.email.data,
        form.room.data,
        form.center.data
        )
        db_session.add(supervisor)
        db_session.commit()
     return redirect('/')