|
|
@ -97,7 +97,8 @@ def modify_user():
|
|
|
|
if form.op_level.data: el.op_level = form.op_level.data
|
|
|
|
if form.op_level.data: el.op_level = form.op_level.data
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('New {} has been created.'.format(str(el)))
|
|
|
|
#flash('New {} has been created.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('New user has been created.')
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
el = User.query.get(form.id.data)
|
|
|
|
el = User.query.get(form.id.data)
|
|
|
@ -112,7 +113,8 @@ def modify_user():
|
|
|
|
|
|
|
|
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('{} deleted.'.format(str(el)))
|
|
|
|
#flash('{} deleted.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('User deleted.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.edit.data:
|
|
|
|
elif form.edit.data:
|
|
|
|
# if form.username.data: el.username = form.username.data
|
|
|
|
# if form.username.data: el.username = form.username.data
|
|
|
@ -122,7 +124,8 @@ def modify_user():
|
|
|
|
if form.op_level.raw_data and form.op_level.data: el.op_level = form.op_level.data
|
|
|
|
if form.op_level.raw_data and form.op_level.data: el.op_level = form.op_level.data
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
#flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Changes to user have been applied.')
|
|
|
|
|
|
|
|
|
|
|
|
flasherrors(form)
|
|
|
|
flasherrors(form)
|
|
|
|
return redirect(url_for('.manage_users'))
|
|
|
|
return redirect(url_for('.manage_users'))
|
|
|
@ -146,7 +149,8 @@ def modify_post():
|
|
|
|
el.remove_image_files()
|
|
|
|
el.remove_image_files()
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('{} deleted.'.format(str(el)))
|
|
|
|
#flash('{} deleted.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Post deleted.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.edit.data:
|
|
|
|
elif form.edit.data:
|
|
|
|
if form.rating.raw_data and form.rating.data: el.rating = form.rating.data
|
|
|
|
if form.rating.raw_data and form.rating.data: el.rating = form.rating.data
|
|
|
@ -163,7 +167,8 @@ def modify_post():
|
|
|
|
el.tags = tags
|
|
|
|
el.tags = tags
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
#flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Changes to post have been applied.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.approve.data:
|
|
|
|
elif form.approve.data:
|
|
|
|
if not current_user.is_moderator:
|
|
|
|
if not current_user.is_moderator:
|
|
|
@ -173,7 +178,8 @@ def modify_post():
|
|
|
|
el.approver = current_user
|
|
|
|
el.approver = current_user
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('Approved post {}.'.format(str(el)))
|
|
|
|
#flash('Approved post {}.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Post approved.')
|
|
|
|
# redirect(url_for('post.post_show', id=el.id))
|
|
|
|
# redirect(url_for('post.post_show', id=el.id))
|
|
|
|
|
|
|
|
|
|
|
|
flasherrors(form)
|
|
|
|
flasherrors(form)
|
|
|
@ -198,21 +204,24 @@ def modify_tag():
|
|
|
|
if form.category.raw_data and form.category.data: el.category = form.category.data
|
|
|
|
if form.category.raw_data and form.category.data: el.category = form.category.data
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('New {} has been created.'.format(str(el)))
|
|
|
|
#flash('New {} has been created.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('New tag has been created.')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
el = Tag.query.get(form.id.data)
|
|
|
|
el = Tag.query.get(form.id.data)
|
|
|
|
|
|
|
|
|
|
|
|
if form.delete.data:
|
|
|
|
if form.delete.data:
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('{} deleted.'.format(str(el)))
|
|
|
|
#flash('{} deleted.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Tag deleted.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.edit.data:
|
|
|
|
elif form.edit.data:
|
|
|
|
# if form.content.data: el.content = form.content.data
|
|
|
|
# if form.content.data: el.content = form.content.data
|
|
|
|
if form.category.raw_data and form.category.data: el.category = form.category.data
|
|
|
|
if form.category.raw_data and form.category.data: el.category = form.category.data
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
#flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Changes to tag have been applied.')
|
|
|
|
|
|
|
|
|
|
|
|
flasherrors(form)
|
|
|
|
flasherrors(form)
|
|
|
|
return redirect(url_for('.manage_tags'))
|
|
|
|
return redirect(url_for('.manage_tags'))
|
|
|
@ -233,7 +242,8 @@ def modify_comment():
|
|
|
|
if form.delete.data:
|
|
|
|
if form.delete.data:
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.delete(el)
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('{} deleted.'.format(str(el)))
|
|
|
|
#flash('{} deleted.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Comment deleted.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.edit.data:
|
|
|
|
elif form.edit.data:
|
|
|
|
# if form.rating.raw_data and form.rating.data: el.rating = form.rating.data
|
|
|
|
# if form.rating.raw_data and form.rating.data: el.rating = form.rating.data
|
|
|
@ -241,21 +251,24 @@ def modify_comment():
|
|
|
|
# if form.source.raw_data: el.source = form.source.data
|
|
|
|
# if form.source.raw_data: el.source = form.source.data
|
|
|
|
|
|
|
|
|
|
|
|
# db.session.commit()
|
|
|
|
# db.session.commit()
|
|
|
|
flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
#flash('Changes to {} have been applied.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Changes to comment have been applied.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.ban.data:
|
|
|
|
elif form.ban.data:
|
|
|
|
el.ban_reason = form.ban_reason.data
|
|
|
|
el.ban_reason = form.ban_reason.data
|
|
|
|
el.banned = True
|
|
|
|
el.banned = True
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('Comment {} has been banned.'.format(str(el)))
|
|
|
|
#flash('Comment {} has been banned.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Comment has been banned.')
|
|
|
|
|
|
|
|
|
|
|
|
elif form.unban.data:
|
|
|
|
elif form.unban.data:
|
|
|
|
el.ban_reason = None
|
|
|
|
el.ban_reason = None
|
|
|
|
el.banned = False
|
|
|
|
el.banned = False
|
|
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
flash('Comment {} has been unbanned.'.format(str(el)))
|
|
|
|
#flash('Comment {} has been unbanned.'.format(str(el)))
|
|
|
|
|
|
|
|
flash('Comment has been unbanned.')
|
|
|
|
|
|
|
|
|
|
|
|
flasherrors(form)
|
|
|
|
flasherrors(form)
|
|
|
|
if form.referer.data == 'post_show':
|
|
|
|
if form.referer.data == 'post_show':
|
|
|
|