Create proper edit profile form w/ CSRF & refactor User.about_me null/empty string handling

This commit is contained in:
Xevion
2022-03-29 16:37:12 -05:00
parent bad80cf483
commit 839ef370be
5 changed files with 28 additions and 25 deletions

View File

@@ -37,6 +37,9 @@ class User(UserMixin, db.Model):
def get_post_count(self) -> int:
return len(self.posts)
def display_about(self) -> str:
return self.about_me or "This user hasn't written a bio yet."
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
author = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)