def reset_db(): for user in User.all(): user.delete() for ycs in YearCourseSemester.all(): ycs.delete() for mod in Module.all(): mod.delete() for sub in Subscription.all(): sub.delete() for sub in Category.all(): sub.delete() for i in Thread.all(): i.delete() for i in Post.all(): i.delete() for i in Rating.all(): i.delete() for i in Assessment.all(): i.delete() for i in Grade.all(): i.delete() for i in Lecturer.all(): i.delete() for i in LecturerRating.all(): i.delete()
def deletePosts(pid) : pst = Post.get(pid) for p in pst.replies : if len(p.replies.fetch(1)) > 0 : deletePosts(p.key()) p.delete()