From 962778b8f9cba68084e01be58ab54397ebbf4c43 Mon Sep 17 00:00:00 2001 From: jwheller0013 Date: Sat, 29 Mar 2025 15:00:02 -0400 Subject: [PATCH 1/8] A profile page you can view if logged in. --- .DS_Store | Bin 0 -> 6148 bytes .idea/inspectionProfiles/Project_Default.xml | 6 ++++ forum/app.py | 4 +-- forum/models.py | 36 +++++++++++++++++++ forum/routes.py | 30 ++++++++++++++++ forum/templates/header.html | 8 ++++- forum/templates/user.html | 25 +++++++++++++ forum/templates/viewpost.html | 6 ++-- 8 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 .DS_Store create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 forum/templates/user.html diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bce60af7d6d7e1b646313e41baab387728bab72a GIT binary patch literal 6148 zcmeHKL2uJA82#LJTS^7$0i<1!B5|Ecfx(2hl+sCXKtd~m1EA2fVU3pBrAb>*HK}L# z5BvqL{1W~PCwQOjL6a7tT@V`nB>Oq`drAE4*f9}_)}()fs76E{5@Y!SvNgf&oK~V_ zYc2tWzDJL`)T04K6s)jag>%3;@UJ<*-)tW3Z3GuG5hE1;xjL!oyog zN-0ARB;G74@W1_uAI{Q|?d_Lvl*DP)XnYl=jq>K!wzut7y;q%qnsu^nHc4CE@e96s zs#Fr5mb>AzIGP2u%MX;yy0MJLS`hamP+mTdWnax&Y9jlo)^<#TSMe%AZD&5;+rPc* z?=|*McK!L?n+=q2-8ng_cvr4nzjqiMCqt<|pbrRvwN}SPi>JVztoShPjAf$a5!zVi z(G%@!Pmfzt^r^(W{3svN0mi;fkAZ7OLeGm&OY@?J`$zN^;}+}E5LXi8l0u!)JIeAS zLp)2C^;=L)pr}JJ$aD2PS>~2$s_#B6@Ysp9ymKuYcM*v_M)jCk-p9R+V7Mm6q2GN2LMhY}iVUHNX$WiZGUen^j zpplcXhYw+&EbIwI=%?fUzNV9C8g#jHz&Vh2V8dM2c>h26{rNvHa#zj)=fJsgK$P2^ zb_-pyd+SQ)c(3)5UL$cZZ(&eNklF267kDe)LDGRXp9{dI#f3rCAl#3Dw!vl2fxqg& E4+qi?5&!@I literal 0 HcmV?d00001 diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..ac21435 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/forum/app.py b/forum/app.py index 4d8a828..30c63df 100644 --- a/forum/app.py +++ b/forum/app.py @@ -6,8 +6,8 @@ from . import create_app app = create_app() -app.config['SITE_NAME'] = 'Schooner' -app.config['SITE_DESCRIPTION'] = 'a schooner forum' +app.config['SITE_NAME'] = 'BillyBob' +app.config['SITE_DESCRIPTION'] = 'a BillyBob forum no bobs or billies' app.config['FLASK_DEBUG'] = 1 def init_site(): diff --git a/forum/models.py b/forum/models.py index 8add9ae..d2d564f 100644 --- a/forum/models.py +++ b/forum/models.py @@ -17,6 +17,7 @@ class User(UserMixin, db.Model): admin = db.Column(db.Boolean, default=False) posts = db.relationship("Post", backref="user") comments = db.relationship("Comment", backref="user") + # replies = db.relationship("Reply", backref="user") def __init__(self, email, username, password): self.email = email @@ -115,6 +116,41 @@ def get_time_string(self): self.savedresponce = "Just a moment ago!" return self.savedresponce +# class Reply(db.Model): +# id = db.Column(db.Integer, primary_key=True) +# content = db.Column(db.Text) +# postdate = db.Column(db.DateTime) +# user_id = db.Column(db.Integer, db.ForeignKey('user.id')) +# comment_id = db.Column(db.Integer, db.ForeignKey("comment.id")) +# +# lastcheck = None +# savedresponce = None +# def __init__(self, content, postdate): +# self.content = content +# self.postdate = postdate +# def get_time_string(self): +# #this only needs to be calculated every so often, not for every request +# #this can be a rudamentary chache +# now = datetime.datetime.now() +# if self.lastcheck is None or (now - self.lastcheck).total_seconds() > 30: +# self.lastcheck = now +# else: +# return self.savedresponce +# +# diff = now - self.postdate +# seconds = diff.total_seconds() +# if seconds / (60 * 60 * 24 * 30) > 1: +# self.savedresponce = " " + str(int(seconds / (60 * 60 * 24 * 30))) + " months ago" +# elif seconds / (60 * 60 * 24) > 1: +# self.savedresponce = " " + str(int(seconds / (60* 60 * 24))) + " days ago" +# elif seconds / (60 * 60) > 1: +# self.savedresponce = " " + str(int(seconds / (60 * 60))) + " hours ago" +# elif seconds / (60) > 1: +# self.savedresponce = " " + str(int(seconds / 60)) + " minutes ago" +# else: +# self.savedresponce = "Just a moment ago!" +# return self.savedresponce + def error(errormessage): return "" + errormessage + "" diff --git a/forum/routes.py b/forum/routes.py index 75993e5..19a4160 100644 --- a/forum/routes.py +++ b/forum/routes.py @@ -117,6 +117,21 @@ def comment(): db.session.commit() return redirect("/viewpost?post=" + str(post_id)) +# @login_required +# @rt.route('/action_reply', methods=['POST', 'GET']) #attempt to mimic comment as a reply +# def reply(): +# comment_id = int(request.args.get("Comment")) +# comment = Post.query.filter(Comment.id == comment_id).first() +# if not comment: +# return error("That post does not exist!") +# content = request.form['content'] +# postdate = datetime.datetime.now() +# reply = Reply(content, postdate) +# current_user.reply.append(reply) +# post.reply.append(reply) +# db.session.commit() +# return redirect("/viewpost?post=" + str(post_id)) + @login_required @rt.route('/action_post', methods=['POST']) def action_post(): @@ -145,3 +160,18 @@ def action_post(): db.session.commit() return redirect("/viewpost?post=" + str(post.id)) +@login_required +@rt.route('/user') +def user(): + user_id = request.args.get('user_id') + + if user_id: + user = User.query.get_or_404(user_id) + posts = Post.query.filter(Post.user_id == user.id).all() + return render_template('user.html', user=user, posts=posts) + elif current_user.is_authenticated: + return redirect(url_for('user', user_id=current_user.id)) + else: + return redirect ('/loginform') + + diff --git a/forum/templates/header.html b/forum/templates/header.html index 9403a0d..6ac0568 100644 --- a/forum/templates/header.html +++ b/forum/templates/header.html @@ -5,4 +5,10 @@ {% else %} Click here to login or register! {% endif %} - \ No newline at end of file + + +{% if current_user.is_authenticated %} +
+ Profile +
+{% endif %} \ No newline at end of file diff --git a/forum/templates/user.html b/forum/templates/user.html new file mode 100644 index 0000000..3023640 --- /dev/null +++ b/forum/templates/user.html @@ -0,0 +1,25 @@ +{% extends 'layout.html' %} +{% block body %} +{{ path|safe }} + + {% if current_user.is_authenticated %} +

Welcome, {{ user.username }}

+

These are your posts:

+ {% if posts %} +
    + {% for post in posts %} +
  • + {{post.title}} +

    {{ post.content }}

    +
  • + {% endfor %} +
+ {% else %} +

You have no posts at this time.

+ {% endif %} + + {% else %} + Click here to login or register! + {% endif %} + +{% endblock %} \ No newline at end of file diff --git a/forum/templates/viewpost.html b/forum/templates/viewpost.html index 3f489ca..89db1c5 100644 --- a/forum/templates/viewpost.html +++ b/forum/templates/viewpost.html @@ -1,7 +1,7 @@ {% extends 'layout.html' %} {% block body %} {{ path|safe}} - +

Test1

{{post.title}} @@ -38,10 +38,10 @@ {%if comments%}
{% for comment in comments %} - +
- ({{ comment.user.username }}) - + ({{ comment.user.username }}) -
{{ comment.content }} From 16c23e51ae587e0c153e48d8684f52f14cf19eaa Mon Sep 17 00:00:00 2001 From: jwheller0013 Date: Sat, 29 Mar 2025 15:10:10 -0400 Subject: [PATCH 2/8] attempt 2 --- forum/templates/viewpost.html | 1 - 1 file changed, 1 deletion(-) diff --git a/forum/templates/viewpost.html b/forum/templates/viewpost.html index 89db1c5..3823674 100644 --- a/forum/templates/viewpost.html +++ b/forum/templates/viewpost.html @@ -1,7 +1,6 @@ {% extends 'layout.html' %} {% block body %} {{ path|safe}} -

Test1

{{post.title}} From 5b15909dbbcd980178d4ecf028be5b85f3affdda Mon Sep 17 00:00:00 2001 From: KunleAdeyanju Date: Sat, 29 Mar 2025 17:23:05 -0400 Subject: [PATCH 3/8] getting somewhere --- forum/.DS_Store | Bin 0 -> 6148 bytes forum/static/style.css | 4 +-- forum/templates/.DS_Store | Bin 0 -> 6148 bytes forum/templates/createpost.html | 7 ++-- forum/templates/header.html | 16 +++++++-- forum/templates/layout.html | 59 ++++++++++++++++++++++---------- forum/templates/viewpost.html | 6 ++-- 7 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 forum/.DS_Store create mode 100644 forum/templates/.DS_Store diff --git a/forum/.DS_Store b/forum/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 -
+ +
-
+
- +
{% endblock %} \ No newline at end of file diff --git a/forum/templates/header.html b/forum/templates/header.html index 9403a0d..de2f78b 100644 --- a/forum/templates/header.html +++ b/forum/templates/header.html @@ -1,5 +1,17 @@ -{{ config.SITE_NAME }}{% if config.SITE_DESCRIPTION %} - {% endif %} {{ config.SITE_DESCRIPTION }} -
-
- +
+
@@ -29,7 +29,7 @@ {% if current_user.is_authenticated %} - + {% else %} Login or register to make a comment From 9e14d37c189cb02488cecb3a4cc93c10585e80eb Mon Sep 17 00:00:00 2001 From: jwheller0013 Date: Sat, 29 Mar 2025 18:01:42 -0400 Subject: [PATCH 4/8] Change password button --- forum/routes.py | 25 ++++++++++++++++++++++++- forum/templates/change_password.html | 15 +++++++++++++++ forum/templates/header.html | 1 + forum/templates/user.html | 13 +++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 forum/templates/change_password.html diff --git a/forum/routes.py b/forum/routes.py index 19a4160..ac3a248 100644 --- a/forum/routes.py +++ b/forum/routes.py @@ -168,10 +168,33 @@ def user(): if user_id: user = User.query.get_or_404(user_id) posts = Post.query.filter(Post.user_id == user.id).all() - return render_template('user.html', user=user, posts=posts) + comments = Comment.query.filter(Comment.user_id == user.id).all() + return render_template('user.html', user=user, posts=posts, comments= comments) elif current_user.is_authenticated: return redirect(url_for('user', user_id=current_user.id)) else: return redirect ('/loginform') +@login_required +@rt.route('/change_password', methods=['POST', 'GET']) +def change_password(): + if request.method == 'POST': + old_password = request.form['old_password'] + new_password = request.form['new_password'] + confirm_password = request.form['confirm_password'] + + if not check_password_hash(current_user.password, old_password): + flash('Old password does not match records.') + return redirect(url_for('change_password')) + + if new_password != confirm_password: + flash('New and confirm do not match.') + return redirect(url_for('change_password')) + + current_user.password = generate_password_hash(new_password) + db.session.commit() + + flash('Password has been updated') + return redirect(url_for('user')) + return render_template('change_password.html') \ No newline at end of file diff --git a/forum/templates/change_password.html b/forum/templates/change_password.html new file mode 100644 index 0000000..53d6458 --- /dev/null +++ b/forum/templates/change_password.html @@ -0,0 +1,15 @@ +{% extends 'layout.html' %} +{% block body %} +{{ path|safe }} + +
+

Change Password

+
+
+
+
+ +
+
+ +{% endblock %} \ No newline at end of file diff --git a/forum/templates/header.html b/forum/templates/header.html index 6ac0568..191379f 100644 --- a/forum/templates/header.html +++ b/forum/templates/header.html @@ -10,5 +10,6 @@ {% if current_user.is_authenticated %} {% endif %} \ No newline at end of file diff --git a/forum/templates/user.html b/forum/templates/user.html index 3023640..7b443bf 100644 --- a/forum/templates/user.html +++ b/forum/templates/user.html @@ -17,6 +17,19 @@

These are your posts:

{% else %}

You have no posts at this time.

{% endif %} +

These are your comments:

+ {% if comments %} +
    + {% for comment in comments %} +
  • + {{comment.postdate}} +

    {{ comment.content }}

    +
  • + {% endfor %} +
+ {% else %} +

You have no comments at this time.

+ {% endif %} {% else %} Click here to login or register! From f34d77930b2ef46f8174f2aa7fb42d4ce2f8933c Mon Sep 17 00:00:00 2001 From: jwheller0013 Date: Sun, 30 Mar 2025 11:09:16 -0400 Subject: [PATCH 5/8] Fixed flash for password --- forum/routes.py | 21 +++++++++++---------- forum/templates/change_password.html | 13 +++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/forum/routes.py b/forum/routes.py index ac3a248..3038637 100644 --- a/forum/routes.py +++ b/forum/routes.py @@ -1,10 +1,11 @@ -from flask import render_template, request, redirect, url_for +from flask import render_template, request, redirect, url_for, flash from flask_login import current_user, login_user, logout_user from flask_login.utils import login_required import datetime from flask import Blueprint, render_template, request, redirect, url_for from forum.models import User, Post, Comment, Subforum, valid_content, valid_title, db, generateLinkPath, error from forum.user import username_taken, email_taken, valid_username +from werkzeug.security import generate_password_hash, check_password_hash ## # This file needs to be broken up into several, to make the project easier to work on. @@ -171,7 +172,7 @@ def user(): comments = Comment.query.filter(Comment.user_id == user.id).all() return render_template('user.html', user=user, posts=posts, comments= comments) elif current_user.is_authenticated: - return redirect(url_for('user', user_id=current_user.id)) + return redirect(url_for('routes.user', user_id=current_user.id)) else: return redirect ('/loginform') @@ -183,18 +184,18 @@ def change_password(): new_password = request.form['new_password'] confirm_password = request.form['confirm_password'] - if not check_password_hash(current_user.password, old_password): - flash('Old password does not match records.') - return redirect(url_for('change_password')) + if not check_password_hash(current_user.password_hash, old_password): + flash('Old password does not match records.', 'danger') + return redirect(url_for('routes.change_password')) if new_password != confirm_password: - flash('New and confirm do not match.') - return redirect(url_for('change_password')) + flash('New and confirm do not match.', 'warning') + return redirect(url_for('routes.change_password')) - current_user.password = generate_password_hash(new_password) + current_user.password_hash = generate_password_hash(new_password) db.session.commit() - flash('Password has been updated') - return redirect(url_for('user')) + flash('Password has been updated', 'success') + return redirect(url_for('routes.change_password')) return render_template('change_password.html') \ No newline at end of file diff --git a/forum/templates/change_password.html b/forum/templates/change_password.html index 53d6458..c69253f 100644 --- a/forum/templates/change_password.html +++ b/forum/templates/change_password.html @@ -4,6 +4,19 @@

Change Password

+ + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} +
+ {% for category, message in messages %} +
+ {{ message }} +
+ {% endfor %} +
+ {% endif %} + {% endwith %} +


From 1f9840fb29c6d0dca4ddb414555b46aae386c21f Mon Sep 17 00:00:00 2001 From: jwheller0013 Date: Sun, 30 Mar 2025 14:07:19 -0400 Subject: [PATCH 6/8] replies working properly updated profile to show too --- .DS_Store | Bin 6148 -> 6148 bytes forum/models.py | 76 ++++++++++++++++++---------------- forum/routes.py | 29 ++++++------- forum/templates/user.html | 18 +++++++- forum/templates/viewpost.html | 59 +++++++++++++++++++------- 5 files changed, 114 insertions(+), 68 deletions(-) diff --git a/.DS_Store b/.DS_Store index bce60af7d6d7e1b646313e41baab387728bab72a..e50103f538609ab71aa7d188d253780d287697b7 100644 GIT binary patch delta 103 zcmZoMXffEZkVTx8A&nuQp@^ZBAvdYKxF9JfKZ${XVb^2@)S|p>69WSs1rwvm wjqEavJ(K6L%S-nH6(DIV3ogpb$>Pjj0k!=ck^lez delta 71 zcmZoMXffEZkY#c|YYKlRLmophLkUA7kWOYuo&16AxGV<)nrK;YQC?1dUOEE<1LNj* Nto%%y**X650|4!U6jlHL diff --git a/forum/models.py b/forum/models.py index d2d564f..6a6ccff 100644 --- a/forum/models.py +++ b/forum/models.py @@ -17,7 +17,6 @@ class User(UserMixin, db.Model): admin = db.Column(db.Boolean, default=False) posts = db.relationship("Post", backref="user") comments = db.relationship("Comment", backref="user") - # replies = db.relationship("Reply", backref="user") def __init__(self, email, username, password): self.email = email @@ -87,6 +86,8 @@ class Comment(db.Model): postdate = db.Column(db.DateTime) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) post_id = db.Column(db.Integer, db.ForeignKey("post.id")) + replies = db.relationship('Reply', backref='comment', cascade='all, delete-orphan') + lastcheck = None savedresponce = None @@ -116,40 +117,45 @@ def get_time_string(self): self.savedresponce = "Just a moment ago!" return self.savedresponce -# class Reply(db.Model): -# id = db.Column(db.Integer, primary_key=True) -# content = db.Column(db.Text) -# postdate = db.Column(db.DateTime) -# user_id = db.Column(db.Integer, db.ForeignKey('user.id')) -# comment_id = db.Column(db.Integer, db.ForeignKey("comment.id")) -# -# lastcheck = None -# savedresponce = None -# def __init__(self, content, postdate): -# self.content = content -# self.postdate = postdate -# def get_time_string(self): -# #this only needs to be calculated every so often, not for every request -# #this can be a rudamentary chache -# now = datetime.datetime.now() -# if self.lastcheck is None or (now - self.lastcheck).total_seconds() > 30: -# self.lastcheck = now -# else: -# return self.savedresponce -# -# diff = now - self.postdate -# seconds = diff.total_seconds() -# if seconds / (60 * 60 * 24 * 30) > 1: -# self.savedresponce = " " + str(int(seconds / (60 * 60 * 24 * 30))) + " months ago" -# elif seconds / (60 * 60 * 24) > 1: -# self.savedresponce = " " + str(int(seconds / (60* 60 * 24))) + " days ago" -# elif seconds / (60 * 60) > 1: -# self.savedresponce = " " + str(int(seconds / (60 * 60))) + " hours ago" -# elif seconds / (60) > 1: -# self.savedresponce = " " + str(int(seconds / 60)) + " minutes ago" -# else: -# self.savedresponce = "Just a moment ago!" -# return self.savedresponce +class Reply(db.Model): + id = db.Column(db.Integer, primary_key=True) + content = db.Column(db.Text) + postdate = db.Column(db.DateTime) + user_id = db.Column(db.Integer, db.ForeignKey('user.id')) + comment_id = db.Column(db.Integer, db.ForeignKey("comment.id")) + + user = db.relationship('User', backref='replies') + + + lastcheck = None + savedresponce = None + def __init__(self, content, postdate, user_id, comment_id): + self.content = content + self.postdate = postdate + self.user_id = user_id + self.comment_id = comment_id + def get_time_string(self): + #this only needs to be calculated every so often, not for every request + #this can be a rudamentary chache + now = datetime.datetime.now() + if self.lastcheck is None or (now - self.lastcheck).total_seconds() > 30: + self.lastcheck = now + else: + return self.savedresponce + + diff = now - self.postdate + seconds = diff.total_seconds() + if seconds / (60 * 60 * 24 * 30) > 1: + self.savedresponce = " " + str(int(seconds / (60 * 60 * 24 * 30))) + " months ago" + elif seconds / (60 * 60 * 24) > 1: + self.savedresponce = " " + str(int(seconds / (60* 60 * 24))) + " days ago" + elif seconds / (60 * 60) > 1: + self.savedresponce = " " + str(int(seconds / (60 * 60))) + " hours ago" + elif seconds / (60) > 1: + self.savedresponce = " " + str(int(seconds / 60)) + " minutes ago" + else: + self.savedresponce = "Just a moment ago!" + return self.savedresponce def error(errormessage): return "" + errormessage + "" diff --git a/forum/routes.py b/forum/routes.py index 3038637..46db246 100644 --- a/forum/routes.py +++ b/forum/routes.py @@ -3,7 +3,7 @@ from flask_login.utils import login_required import datetime from flask import Blueprint, render_template, request, redirect, url_for -from forum.models import User, Post, Comment, Subforum, valid_content, valid_title, db, generateLinkPath, error +from forum.models import User, Post, Comment, Subforum, valid_content, valid_title, db, generateLinkPath, error, Reply from forum.user import username_taken, email_taken, valid_username from werkzeug.security import generate_password_hash, check_password_hash @@ -118,20 +118,16 @@ def comment(): db.session.commit() return redirect("/viewpost?post=" + str(post_id)) -# @login_required -# @rt.route('/action_reply', methods=['POST', 'GET']) #attempt to mimic comment as a reply -# def reply(): -# comment_id = int(request.args.get("Comment")) -# comment = Post.query.filter(Comment.id == comment_id).first() -# if not comment: -# return error("That post does not exist!") -# content = request.form['content'] -# postdate = datetime.datetime.now() -# reply = Reply(content, postdate) -# current_user.reply.append(reply) -# post.reply.append(reply) -# db.session.commit() -# return redirect("/viewpost?post=" + str(post_id)) +@login_required +@rt.route('/action_reply/comment/', methods=['POST']) #attempt to mimic comment as a reply +def action_reply(comment_id): + comment = Comment.query.get_or_404(comment_id) + content = request.form['content'] + postdate = datetime.datetime.now() + reply = Reply(content=content, postdate=postdate, user_id=current_user.id, comment_id=comment_id) + db.session.add(reply) + db.session.commit() + return redirect(url_for('routes.viewpost', post=comment.post_id)) @login_required @rt.route('/action_post', methods=['POST']) @@ -170,7 +166,8 @@ def user(): user = User.query.get_or_404(user_id) posts = Post.query.filter(Post.user_id == user.id).all() comments = Comment.query.filter(Comment.user_id == user.id).all() - return render_template('user.html', user=user, posts=posts, comments= comments) + replies = Reply.query.filter(Reply.user_id == user.id).all() + return render_template('user.html', user=user, posts=posts, comments= comments, replies= replies) elif current_user.is_authenticated: return redirect(url_for('routes.user', user_id=current_user.id)) else: diff --git a/forum/templates/user.html b/forum/templates/user.html index 7b443bf..f5bab63 100644 --- a/forum/templates/user.html +++ b/forum/templates/user.html @@ -17,12 +17,12 @@

These are your posts:

{% else %}

You have no posts at this time.

{% endif %} -

These are your comments:

+

These are your comments:

{% if comments %}
    {% for comment in comments %}
  • - {{comment.postdate}} + {{comment.post.title}}

    {{ comment.content }}

  • {% endfor %} @@ -31,6 +31,20 @@

    These are your comments:

    You have no comments at this time.

    {% endif %} +

    These are your replies:

    + {% if replies %} + + {% else %} +

    You have no replies at this time.

    + {% endif %} + {% else %} Click here to login or register! {% endif %} diff --git a/forum/templates/viewpost.html b/forum/templates/viewpost.html index 3823674..7bae3f8 100644 --- a/forum/templates/viewpost.html +++ b/forum/templates/viewpost.html @@ -24,11 +24,8 @@
- - - {% if current_user.is_authenticated %} - + {% else %} Login or register to make a comment @@ -49,24 +46,56 @@
{{ comment.get_time_string() }}
+ + {% if current_user.is_authenticated %} +
+ + +
+ {% endif %} + + {% if comment.replies %} +
+ {% for reply in comment.replies %} +
+
+ ({{ reply.user.username }}) - +
+
+ {{ reply.content }} +
+
+ {{ reply.get_time_string() }} +
+
+ {% endfor %} +
+ {% endif %} +

{% endfor %}
{% endif %} + From 46019dd80ae6c548d50345620e41f1731b8cc297 Mon Sep 17 00:00:00 2001 From: jwheller0013 Date: Mon, 31 Mar 2025 09:19:42 -0400 Subject: [PATCH 7/8] Changed name --- forum/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forum/app.py b/forum/app.py index 30c63df..0ae7641 100644 --- a/forum/app.py +++ b/forum/app.py @@ -6,8 +6,8 @@ from . import create_app app = create_app() -app.config['SITE_NAME'] = 'BillyBob' -app.config['SITE_DESCRIPTION'] = 'a BillyBob forum no bobs or billies' +app.config['SITE_NAME'] = 'Something, Anything, that is not that' +app.config['SITE_DESCRIPTION'] = 'a forum for Data to learn from' app.config['FLASK_DEBUG'] = 1 def init_site(): From 2ffe668364ca9f4fa5d66db7660650efd980b33b Mon Sep 17 00:00:00 2001 From: KunleAdeyanju Date: Mon, 31 Mar 2025 09:37:36 -0400 Subject: [PATCH 8/8] background color changed --- forum/templates/header.html | 2 +- forum/templates/layout.html | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/forum/templates/header.html b/forum/templates/header.html index de2f78b..b393dbb 100644 --- a/forum/templates/header.html +++ b/forum/templates/header.html @@ -1,4 +1,4 @@ -