Ejemplo n.º 1
0
    def post(self):
        name = self.request_string("name")
        description = self.request_string("description")
        full_description = self.request_string("full_description")
        points = self.request_int("points", default = -1)
        badge_category = self.request_int("badge_category", default = -1)
        icon_src = self.request_string("icon_src", default="")

        # Create custom badge
        if CustomBadgeType.insert(name, description, full_description, points, badge_category, icon_src):

            util_badges.all_badges(bust_cache=True)
            util_badges.all_badges_dict(bust_cache=True)

            self.redirect("/badges/custom/award")
            return

        self.redirect("/badges/custom/create?failed=1")
Ejemplo n.º 2
0
 def all():
     return [
         CustomBadge(badge_type) for badge_type in CustomBadgeType.all()
     ]
Ejemplo n.º 3
0
 def all():
     custom_badges = []
     custom_badge_types = CustomBadgeType.all().fetch(1000)
     for custom_badge_type in custom_badge_types:
         custom_badges.append(CustomBadge(custom_badge_type))
     return custom_badges
Ejemplo n.º 4
0
 def all():
     return [CustomBadge(badge_type) for badge_type
             in CustomBadgeType.all()]