def edit_category(category_id): """修改分类""" category = Category.query.get_or_404(category_id) form = CategoryForm() if form.validate_on_submit(): if form.name.data == Category.query.get(1).name: flash( "You can't move the category name to the default category name.", 'warning') return redirect(url_for('admin.manage_category')) category.name = form.name.data db.session.commit() flash('Category edited.', 'success') return redirect(url_for('admin.manage_category')) form.name.data = category.name return render_template('admin/edit_category.html', form=form)
def show_category(): form = CategoryForm() return render_template('blog/category.html', form=form)
def edit_category(category_id): form = CategoryForm() return render_template('admin/edit_category.html', form=form)
def new_category(): form = CategoryForm() return render_template('admin/new_category.html', form=form)