basic posting
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from flask import Blueprint, redirect, url_for, render_template, request, abort
|
||||
|
||||
from ..auth import login_required, get_active_user
|
||||
from ..models import Threads, Posts, Topics, Users, Reactions
|
||||
import math
|
||||
|
||||
@@ -35,8 +35,17 @@ def thread(slug):
|
||||
return render_template('threads/thread.html', thread=thread, posts=thread.get_posts(PER_PAGE, page), page=page, page_count=page_count, topic=topic, started_by=started_by, topics=Topics.get_list(), Reactions=Reactions)
|
||||
|
||||
@bp.post('/<slug>/reply')
|
||||
@login_required
|
||||
def reply(slug):
|
||||
return 'stub'
|
||||
user = get_active_user()
|
||||
thread = Threads.find({'slug': slug})
|
||||
if not thread:
|
||||
abort(404)
|
||||
if thread.locked() and not user.is_mod():
|
||||
# TODO: flash
|
||||
return redirect(url_for('.thread', slug=slug))
|
||||
post = Posts.new(user.id, thread.id, request.form.get('babycode_content'))
|
||||
return redirect(url_for('.thread', slug=slug, after=post.id, _anchor=f'post-{post.id}'))
|
||||
|
||||
@bp.get('/<slug>/feed.atom')
|
||||
def feed(slug):
|
||||
|
||||
@@ -5,8 +5,12 @@ from ..models import Users
|
||||
|
||||
bp = Blueprint('users', __name__, url_prefix='/users/')
|
||||
|
||||
@bp.get('/log-in')
|
||||
def log_in_page():
|
||||
return 'stub/please log in'
|
||||
|
||||
@bp.post('/log-in')
|
||||
def log_in():
|
||||
def log_in_post():
|
||||
user = Users.find({'username': request.form['username']})
|
||||
if not user:
|
||||
return "no user"
|
||||
|
||||
Reference in New Issue
Block a user