Exemple #1
0
    def get(self):
        # Making sure that the user's profile information is fully filled in
        self.validate()

        # Normal users are restricted to only viewing published quizzes
        quizzes_query = Quiz.all()
        quizzes_query.filter("is_deleting =", False)
        if not self.is_admin:
            quizzes_query.filter("is_published =", True)
        self.values["quizzes"] = quizzes_query.fetch(20)

        # Any user can see their own scores
        attempts_query = Attempt.all()
        attempts_query.filter("user ="******"is_archived =", False)
        attempts_query.order("-created")
        self.values["attempts"] = attempts_query.fetch(3)

        self.output("home.html")