def content_edit(content_id): content = AD_Content.query.get_or_404(content_id) form = ContentForm(obj=content) if form.validate_on_submit(): form.populate_obj(content) db.session.commit() flash(u'广告内容《%s》已修改!' % form.name.data) return redirect(url_for('.content_list')) return render_template('analytics/content_form.html', form=form,is_edit=True)
def content_add(): form = ContentForm() if form.validate_on_submit(): content = AD_Content() form.populate_obj(content) db.session.add(content) db.session.commit() flash(u'广告内容《%s》已添加!' % form.name.data) return redirect(url_for('.content_list')) return render_template('analytics/content_form.html', form=form)
def content_edit(content_id): content = AD_Content.query.get_or_404(content_id) form = ContentForm(obj=content) if form.validate_on_submit(): form.populate_obj(content) db.session.commit() flash(u'广告内容《%s》已修改!' % form.name.data) return redirect(url_for('.content_list')) return render_template('analytics/content_form.html', form=form, is_edit=True)