|
@@ -346,19 +346,24 @@ class ManageForum(MethodView):
|
|
|
|
|
|
class NewPost(MethodView):
|
|
class NewPost(MethodView):
|
|
decorators = [allows.requires(CanPostReply), login_required]
|
|
decorators = [allows.requires(CanPostReply), login_required]
|
|
- form = ReplyForm
|
|
|
|
|
|
|
|
def get(self, topic_id, slug=None):
|
|
def get(self, topic_id, slug=None):
|
|
topic = Topic.query.filter_by(id=topic_id).first_or_404()
|
|
topic = Topic.query.filter_by(id=topic_id).first_or_404()
|
|
- return render_template('forum/new_post.html', topic=topic, form=self.form())
|
|
|
|
|
|
+
|
|
|
|
+ return render_template(
|
|
|
|
+ 'forum/new_post.html', topic=topic, form=self.form()
|
|
|
|
+ )
|
|
|
|
|
|
def post(self, topic_id, slug=None):
|
|
def post(self, topic_id, slug=None):
|
|
topic = Topic.query.filter_by(id=topic_id).first_or_404()
|
|
topic = Topic.query.filter_by(id=topic_id).first_or_404()
|
|
|
|
+
|
|
form = self.form()
|
|
form = self.form()
|
|
|
|
+
|
|
if form.validate_on_submit():
|
|
if form.validate_on_submit():
|
|
if 'preview' in request.form:
|
|
if 'preview' in request.form:
|
|
return render_template(
|
|
return render_template(
|
|
- 'forum/new_post.html', topic=topic, form=form, preview=form.content.data
|
|
|
|
|
|
+ 'forum/new_post.html', topic=topic, form=form,
|
|
|
|
+ preview=form.content.data
|
|
)
|
|
)
|
|
else:
|
|
else:
|
|
post = form.save(real(current_user), topic)
|
|
post = form.save(real(current_user), topic)
|
|
@@ -366,6 +371,10 @@ class NewPost(MethodView):
|
|
|
|
|
|
return render_template('forum/new_post.html', topic=topic, form=form)
|
|
return render_template('forum/new_post.html', topic=topic, form=form)
|
|
|
|
|
|
|
|
+ def form(self):
|
|
|
|
+ current_app.pluggy.hook.flaskbb_form_new_post(form=ReplyForm)
|
|
|
|
+ return ReplyForm()
|
|
|
|
+
|
|
|
|
|
|
class ReplyPost(MethodView):
|
|
class ReplyPost(MethodView):
|
|
decorators = [allows.requires(CanPostReply), login_required]
|
|
decorators = [allows.requires(CanPostReply), login_required]
|