示例#1
0
def profile():
    company = Company.query.get_or_404(current_user.company.id)
    form = CompanyForm(obj=company)
    if form.validate_on_submit():
        form.update_company(company)
        return redirect(url_for('company.profile'))
    return render_template('company/profile.html', form=form)
示例#2
0
def create_company():
    form = CompanyForm()
    if form.validate_on_submit():
        form.create_company()
        flash('公司创建成功', 'success')
        return redirect(url_for('admin.company'))
    return render_template('admin/create_company.html', form=form)
示例#3
0
def edit_company(company_id):
    company = Company.query.get_or_404(company_id)
    form = CompanyForm(obj=company)
    if form.validate_on_submit():
        form.update_company(company)
        flash('公司更新成功', 'success')
        return redirect(url_for('admin.company'))
    return render_template('admin/edit_company.html',
                           form=form,
                           company=company)
示例#4
0
def companyinfo(user_id):
    """企业用户完善企业信息"""

    user = User.query.filter_by(id=user_id).first()
    form = CompanyForm()
    if form.validate_on_submit():
        form.update()
        flash('企业信息创建成功', 'success')
        return redirect(url_for('user.hr_vister'))

    return render_template('user/hr_index.html', user=user, form=form)
示例#5
0
def edit_company(com_id):
    comp = ComInfo.query.get_or_404(com_id)
    user = User.query.get_or_404(com_id)
    form = CompanyForm(obj=comp)
    if form.validate_on_submit():
        form.set_details(comp.user, comp)
        flash('企业更新成功', 'success')
        return redirect(url_for('admin.users'))
    form.com_name.data = user.username
    form.com_email.data = user.email
    return render_template('admin/edit_company.html', form=form, comp=comp)
示例#6
0
def edit_company(com_id):
    comp = ComInfo.query.get_or_404(com_id)
    user = User.query.get_or_404(com_id)
    form = CompanyForm(obj=comp)
    if form.validate_on_submit():
        form.set_details(comp.user, comp)
        flash('企业更新成功', 'success')
        return redirect(url_for('admin.users'))
    form.com_name.data = user.username
    form.com_email.data = user.email
    return render_template('admin/edit_company.html', form=form, comp=comp)
示例#7
0
def setdetail():
    # 此处company的id需要从login获取
    com_tmp = ComInfo.query.get_or_404(current_user.id)
    form = CompanyForm(obj=com_tmp)
    form.com_name.data = current_user.username
    form.com_email.data = current_user.email
    
    if form.validate_on_submit():
        form.set_details(current_user, com_tmp)
        flash('更新信息成功!','success')
        return redirect(url_for('company.index'))
    return render_template('company/set_details.html',form=form)
示例#8
0
def profile():
    if not current_user.is_company:
        flash('您不是企业用户!', 'warning')
        return redirect(url_for('front.index'))
    form = CompanyForm(obj=current_user.company)
    form.name.data = current_user.name
    form.email.data = current_user.email
    if form.validate_on_submit():
        form.update_profile(current_user)
        flash('企业信息更新成功', 'success')
        return redirect(url_for('front.index'))
    return render_template('company/profile.html', form=form)
示例#9
0
def setdetail():
    # 此处company的id需要从login获取
    com_tmp = ComInfo.query.get_or_404(current_user.id)
    form = CompanyForm(obj=com_tmp)
    form.com_name.data = current_user.username
    form.com_email.data = current_user.email

    if form.validate_on_submit():
        form.set_details(current_user, com_tmp)
        flash('更新信息成功!', 'success')
        return redirect(url_for('company.index'))
    return render_template('company/set_details.html', form=form)
示例#10
0
def profile():
    form = CompanyForm()
    if form.validate_on_submit():
        form.create_company()
        flash('已保存', 'success')
    return render_template('company_main.html', form=form)