def feedback(page=1): uid = session.get('uid') if not uid: return redirect(url_for('account.login', next=url_for('job.feedback'))) filter_ = request.args.get('filter', '') if page < 1: page = 1 cnt_total = JobRequest.query.filter(JobRequest.user_id == uid).count() cnt_feedbacked = JobRequest.query.filter(db.and_(JobRequest.user_id==uid, JobRequest.feedbacked==True)).\ count() cnt_checked = JobRequest.query.filter(db.and_(JobRequest.user_id==uid, JobRequest.checked==True)).\ count() query = JobRequest.query.filter(JobRequest.user_id == uid) if filter_: if filter_ == 'unfeedback': query = query.filter(JobRequest.feedbacked == False) else: query = query.filter(JobRequest.feedbacked == True) if filter_ == 'checked': query = query.filter(JobRequest.checked == True) elif filter_ == 'uncheck': query = query.filter(JobRequest.checked == False) query = query.order_by(JobRequest.createdate) page_url = lambda page: url_for('job.feedback', page=page, filter=filter_) page_obj = query.paginate(page=page, per_page=20) return render_template('job-feedback.html', page_obj=page_obj, page_url=page_url, cnt_total=cnt_total, cnt_feedbacked=cnt_feedbacked, cnt_checked=cnt_checked, filter=filter_)
def feedback(page=1): uid = session.get('uid') if not uid: return redirect(url_for('account.login', next=url_for('job.feedback'))) filter_ = request.args.get('filter', '') if page < 1: page = 1 cnt_total = JobRequest.query.filter(JobRequest.user_id==uid).count() cnt_feedbacked = JobRequest.query.filter(db.and_(JobRequest.user_id==uid, JobRequest.feedbacked==True)).\ count() cnt_checked = JobRequest.query.filter(db.and_(JobRequest.user_id==uid, JobRequest.checked==True)).\ count() query = JobRequest.query.filter(JobRequest.user_id==uid) if filter_: if filter_ == 'unfeedback': query = query.filter(JobRequest.feedbacked==False) else: query = query.filter(JobRequest.feedbacked==True) if filter_ == 'checked': query = query.filter(JobRequest.checked==True) elif filter_ == 'uncheck': query = query.filter(JobRequest.checked==False) query = query.order_by(JobRequest.createdate) page_url = lambda page: url_for('job.feedback', page=page,filter=filter_) page_obj = query.paginate(page=page, per_page=20) return render_template('job-feedback.html', page_obj=page_obj, page_url=page_url, cnt_total=cnt_total, cnt_feedbacked=cnt_feedbacked, cnt_checked=cnt_checked, filter=filter_)
def addRequest(job_id): uid = session.get('uid') if not uid: return redirect(url_for('account.login', next=url_for('job.addRequest', job_id=job_id))) job_request = JobRequest.query.filter(db.and_(JobRequest.user_id==uid, JobRequest.job_id==job_id)).first() if job_request: return json.dumps({'success': False, 'message': u'已申请!'}) else: job_request = JobRequest(user_id=uid, job_id=job_id) db.session.add(job_request) db.session.commit() return json.dumps({'success': True, 'from': 'add', 'url': url_for('job.delRequest', req_id=job_request.id)})
def getFeedbackInfo(req_id): uid = session.get('uid') if not uid: return redirect(url_for('account.login')) job_request = JobRequest.query.filter(db.and_(JobRequest.id==req_id, JobRequest.user_id==uid)).first() if not job_request: return json.dumps({'success': False, 'message': u'此职位请求不存在或不为你所有.'}) else: job_request.checked = True db.session.add(job_request) db.session.commit() return json.dumps({'success': True, 'hr_evaluate': job_request.hr_evaluate, 'hr_msg': job_request.hr_msg if job_request.hr_msg else ''})
def getFeedbackInfo(req_id): uid = session.get('uid') if not uid: return redirect(url_for('account.login')) job_request = JobRequest.query.filter( db.and_(JobRequest.id == req_id, JobRequest.user_id == uid)).first() if not job_request: return json.dumps({'success': False, 'message': u'此职位请求不存在或不为你所有.'}) else: job_request.checked = True db.session.add(job_request) db.session.commit() return json.dumps({ 'success': True, 'hr_evaluate': job_request.hr_evaluate, 'hr_msg': job_request.hr_msg if job_request.hr_msg else '' })
def login(): form = LoginForm(next=request.args.get('next', '')) if request.method == 'POST': if form.validate_on_submit(): email = form.email.data password = form.password.data user = User.query.filter( db.and_(User.email == email, User.password == password)).first() if user: session['uid'] = user.id user.lastlogin = datetime.now() db.session.commit() next = form.next.data next = next if next else url_for('frontend.index') return redirect(next) else: flash(u'邮箱地址或密码错误!') else: print form.errors return render_template('login.html', form=form)
def addRequest(job_id): uid = session.get('uid') if not uid: return redirect( url_for('account.login', next=url_for('job.addRequest', job_id=job_id))) job_request = JobRequest.query.filter( db.and_(JobRequest.user_id == uid, JobRequest.job_id == job_id)).first() if job_request: return json.dumps({'success': False, 'message': u'已申请!'}) else: job_request = JobRequest(user_id=uid, job_id=job_id) db.session.add(job_request) db.session.commit() return json.dumps({ 'success': True, 'from': 'add', 'url': url_for('job.delRequest', req_id=job_request.id) })