def unsubscribe(user, module): subs=Subscription.all().filter('subscribed_user ='******'module =', module).run() for s in subs: s.delete() module.student_count-=1 module.put() grades=Grade.all().filter('student =', user).run() for assessm in module.assessments: for grade in grades: if grade.assessment.key() == assessm.key(): grade.delete() lectRats=LecturerRating.all().filter('module =',module).filter('user =',user).run() for lectRat in lectRats: lectRat.delete()
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()