sh4nks 11 лет назад
Родитель
Сommit
279a988728
2 измененных файлов с 7 добавлено и 1 удалено
  1. 1 1
      flaskbb/forum/models.py
  2. 6 0
      flaskbb/user/models.py

+ 1 - 1
flaskbb/forum/models.py

@@ -297,7 +297,7 @@ class Topic(db.Model):
                               TopicsRead.last_read < Topic.last_updated)).\
                 count()
                 # Why doesn't this work with when you pass an last_post object?
-                # Line 294 e.q.: TopicsRead.last_read < last_post.date_created
+                # e.q.: TopicsRead.last_read < last_post.date_created
 
             # Mark it as read if no unread topics are found
             if unread_count == 0:

+ 6 - 0
flaskbb/user/models.py

@@ -294,6 +294,12 @@ class User(db.Model, UserMixin):
         db.session.commit()
         return self
 
+    def delete(self):
+        # TODO: Recount posts in the involved forums and topics
+        db.session.delete(self)
+        db.session.commit()
+        return self
+
 
 class Guest(AnonymousUserMixin):
     @cache.memoize(60*5)