Skip to content

Commit

Permalink
Postpone the form instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaoy1 authored Nov 17, 2024
1 parent e6b0fa5 commit 7232949
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion greybook/blueprints/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ def new_category():
@login_required
def edit_category(category_id):
category = db.session.get(Category, category_id) or abort(404)
form = EditCategoryForm(current_name=category.name)
if category.id == 1:
flash('You can not edit the default category.', 'warning')
return redirect(url_for('blog.index'))
form = EditCategoryForm(current_name=category.name)
if form.validate_on_submit():
category.name = form.name.data
db.session.commit()
Expand Down

0 comments on commit 7232949

Please sign in to comment.