def delivery(): if not current_user.is_user(): return redirect(url_for("front.index")) status = request.args.get("status", None) page = request.args.get("page", default=1, type=int) if status: pagination = ( current_user.delivery.filter_by(status=status) .order_by(Delivery.updated_at.desc()) .paginate( page=page, per_page=current_app.config["LIST_PER_PAGE"], error_out=False ) ) else: pagination = current_user.delivery.order_by( Delivery.updated_at.desc() ).paginate( page=page, per_page=current_app.config["LIST_PER_PAGE"], error_out=False ) return render_template( "user/delivery.html", pagination=pagination, active="manage", panel="delivery", status=status, )
def edit(): if not current_user.is_user(): return redirect(url_for("front.index")) form = UserDetailForm(obj=current_user) if form.validate_on_submit(): form.update_detail(current_user) flash("个人信息更新成功", "success") return redirect(url_for("user.edit")) return render_template("user/edit.html", form=form, active="manage", panel="edit")
def edit(): if not current_user.is_user (): return redirect (url_for ("front.index")) form = UserDetailForm (obj=current_user) if form.validate_on_submit (): form.update_detail (current_user) flash ('个人信息更新成功', 'success') return redirect (url_for ('user.edit')) return render_template ('user/edit.html', form=form, active='manage', panel='edit')
def resume(): '''信息管理''' if not current_user.is_user (): return redirect (url_for ('index.index')) form = UserResumeForm () resume_url = current_user.resume if form.validate_on_submit (): resume_url = form.upload_resume (current_user) return render_template ('user/resume.html', form=form, file_url=resume_url, active='manage', panel='resume')
def reserve_data(): rows = [] # 协管员和管理员可以获取所有预约信息 if current_user.is_moderator() or current_user.is_administrator(): reserveInfos = ReserveInfo.query.all() # 获取该用户的预约信息 elif current_user.is_user(): reserveInfos = ReserveInfo.query.filter_by(user_id=current_user.id).all() for reserveInfo in reserveInfos: rows.append(reserveInfo.getDictObj()) result = json.dumps(rows) return result
def dashboard_archive(): page = int(request.args.get('page', 1)) # get page number from url query string if current_user.is_designer() or current_user.is_admin(): reviews = BannerReview.query.filter_by(reviewed=True, designer_id=current_user.id ).order_by(BannerReview.created_at.desc() ).paginate(page=page, per_page=10) pagination = Pagination(per_page=10, page=page, total=reviews.total, css_framework='bootstrap3') return render_template('user/dashboard_designer_archive.html', reviews=reviews, pagination=pagination) elif current_user.is_user(): reviews = BannerReview.query.filter_by(active=False, user_id=current_user.id ).order_by(BannerReview.created_at.desc() ).paginate(page=page, per_page=10) pagination = Pagination(per_page=10, page=page, total=reviews.total, css_framework='bootstrap3') return render_template('user/dashboard_user_archive.html', reviews=reviews, pagination=pagination)
def delivery(): '''交易''' if not current_user.is_user (): return redirect (url_for ('index.index')) status = request.args.get ('status', None) page = request.args.get ('page', default=1, type=int) if status: pagination = current_user.delivery.filter_by (status=status).order_by (Delivery.updated_at.desc ()).paginate ( page=page, per_page=current_app.config['LIST_PER_PAGE'], error_out=False) else: pagination = current_user.delivery.order_by (Delivery.updated_at.desc ()).paginate ( page=page, per_page=current_app.config['LIST_PER_PAGE'], error_out=False) return render_template ('user/delivery.html', pagination=pagination, active='manage', panel='delivery', status=status)
def resume(): if not current_user.is_user(): return redirect(url_for("front.index")) form = UserResumeForm() # form = form.upload_resume(current_user) resume_url = current_user.resume if form.validate_on_submit(): filename = form.resume.data.filename resume_url = form.upload_resume(current_user, filename) return render_template( "user/resume.html", form=form, file_url=resume_url, active="manage", panel="resume", )
def apply(job_id): job_obj = Job.query.get_or_404(job_id) if not current_user.is_user(): abort(404) if not current_user.resume: flash('请先上传简历', 'warning') return redirect(url_for('user.resume')) elif job_obj.is_applied(): flash('已经投递过该职位', 'warning') return redirect(url_for('job.detail', job_id=job_id)) delivery = Delivery(job_id=job_id, user_id=current_user.id, company_id=job_obj.company.id, resume=current_user.resume) db.session.add(delivery) db.session.commit() flash('简历投递成功', 'success') return redirect(url_for('job.detail', job_id=job_id))
def apply(job_id): job_obj = AllTimeJob.query.get_or_404(job_id) if not current_user.is_user(): abort(404) if not current_user.resume: flash("请先上传简历", "warning") return redirect(url_for("user.resume")) elif job_obj.is_applied(): flash("已经投递过该职位", "warning") return redirect(url_for("job.detail", job_id=job_id)) delivery = Delivery( job_id=job_id, user_id=current_user.id, company_id=job_obj.company.id, resume=current_user.resume, ) db.session.add(delivery) db.session.commit() flash("简历投递成功", "success") return redirect(url_for("job.detail", job_id=job_id))