Tilføj oprettelse af tråde, grupper og opslag
This commit is contained in:
1 parent
0d93a37a5c
commit
4592591c4e
9 files changed
+149
-13
No files matched your search
@@ -0,0 +1,14 @@
|
||||
from flask import render_template, Blueprint, flash, redirect
|
||||
from flask_login import current_user, login_required
|
||||
from aula.models import insert_post
|
||||
from aula.forms import CreatePostForm
|
||||
|
||||
Post = Blueprint('Post', __name__)
|
||||
|
||||
@Post.route("/posts/create", methods=['POST'])
|
||||
@login_required
|
||||
def create():
|
||||
form = CreatePostForm()
|
||||
insert_post(form.group_id.data, form.author_id.data, form.title.data, form.content.data)
|
||||
flash('Opslag blev oprettet', 'success')
|
||||
return redirect(f"/groups/{form.group_id.data}")
|
||||
Reference in new issue
Block a user