summary refs log tree commit diff
path: root/models.py
diff options
context:
space:
mode:
authorMatt Arnold2025-04-11 01:33:39 -0400
committerMatt Arnold2025-04-11 01:33:39 -0400
commitdc557895b1bd517bbdc2821a79f2be12624010d6 (patch)
tree39ad52fae6c5688720f36d608e001c994a76d96f /models.py
parentc51aebd896459f65c675d719347f60fc3aefa781 (diff)
Faccets phase 1 changes, to include
Add a view for a faccets details
Diffstat (limited to 'models.py')
-rw-r--r--models.py12
1 files changed, 10 insertions, 2 deletions
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])