Update database

Correctly link user to their posts and groups
Change the table names to Group, Post and User
Remove unused Bans and Logs table, possibly will return later
This commit is contained in:
Michał Gdula 2023-04-12 15:16:43 +00:00
parent 9a21064dd5
commit d36699bd1f
12 changed files with 185 additions and 270 deletions

View file

@ -5,7 +5,7 @@ from flask import Blueprint, render_template, request
from werkzeug.exceptions import abort
from flask_login import current_user
from gallery.models import Posts, Users
from gallery.models import Post, User
blueprint = Blueprint("profile", __name__, url_prefix="/profile")
@ -26,11 +26,11 @@ def profile():
abort(404, "You must be logged in to view your own profile!")
# Get the user's data
user = Users.query.filter(Users.id == user_id).first()
user = User.query.filter(User.id == user_id).first()
if not user:
abort(404, "User not found :c")
images = Posts.query.filter(Posts.author_id == user_id).all()
images = Post.query.filter(Post.author_id == user_id).all()
return render_template("profile.html", user=user, images=images)