def company_edit(company_id): company = Company.query.get_or_404(company_id) form = CompanyEditForm(obj=company) if form.validate_on_submit(): form.update_company(company) flash('企业信息更新成功', 'success') return redirect(url_for('admin.company_manage')) return render_template('admin/company_edit.html', form=form, company=company)
def profile(): if not current_user.is_company: flash('您不是企业用户', 'warning') return redirect(url_for('front.index')) form = CompanyEditForm(obj=current_user.company_detail) form.name.data = current_user.name form.email.data = current_user.email if form.validate_on_submit(): form.update_company(current_user) flash('企业信息更新成功', 'success') return redirect(url_for('front.index')) return render_template('company/profile.html', form=form)