From dc557895b1bd517bbdc2821a79f2be12624010d6 Mon Sep 17 00:00:00 2001 From: Matt Arnold Date: Fri, 11 Apr 2025 01:33:39 -0400 Subject: Faccets phase 1 changes, to include Add a view for a faccets details --- models.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'models.py') diff --git a/models.py b/models.py index 4f76da7..6e5a5b0 100644 --- a/models.py +++ b/models.py @@ -32,6 +32,7 @@ class Faccet(BaseModel): name = TextField(unique=True) picture = BlobField() bio = TextField() + birth = DateTimeField(default=datetime.now) class Post(BaseModel): @@ -50,10 +51,17 @@ def get_replies(post_id): def get_previous(post_id): tlist = [] lp = Post.get(Post.id == post_id) - while lp.parent != 0: - tlist.append(lp) + while True: + if lp.parent == 0: + break + if lp.id != post_id: + tlist.append(lp) lp = Post.get(Post.id == lp.parent) return tlist +def get_attribed_posts(uid): + return Post.select().where(Post.authour == uid).order_by(Post.created_at.desc()) + + db.create_tables([User, Post, Faccet]) -- cgit 1.4.1-2-gfad0