示例#1
0
    def __before__(self, **kwargs):
        category = ProductCategory.find_by_name('Accommodation')
        if not (len(category.products) == 0 or (len(category.products) == 1 and category.products[0].cost == 0)):
            allowed_categories.append('Accommodation')


        c.product_categories = ProductCategory.find_all()
        self._generate_product_schema()
示例#2
0
    def __before__(self, **kwargs):
        category = ProductCategory.find_by_name('Accommodation')
        if category and not (len(category.products) == 0 or (len(category.products) == 1 and category.products[0].cost == 0)):
            allowed_categories.append('Accommodation')


        c.product_categories = ProductCategory.find_all()
        self._generate_product_schema()
示例#3
0
 def accept(self, id):
     volunteer = Volunteer.find_by_id(id)
     category = ProductCategory.find_by_name("Ticket")
     products = Product.find_by_category(category.id)
     defaults = {}
     if volunteer.ticket_type:
         defaults["ticket_type"] = volunteer.ticket_type.id
     c.products_select = []
     c.products_select.append(["", "No Ticket"])
     for p in products:
         if "Volunteer" in p.description:
             c.products_select.append([p.id, p.description + " - " + h.number_to_currency(p.cost / 100)])
     form = render("volunteer/accept.mako")
     return htmlfill.render(form, defaults)
示例#4
0
 def accept(self, id):
     volunteer = Volunteer.find_by_id(id)
     category = ProductCategory.find_by_name('Ticket')
     products = Product.find_by_category(category.id)
     defaults = {}
     if volunteer.ticket_type:
         defaults['ticket_type'] = volunteer.ticket_type.id
     c.products_select = []
     c.products_select.append(['', 'No Ticket'])
     for p in products:
         if 'Volunteer' in p.description:
             c.products_select.append([
                 p.id,
                 p.description + ' - ' + h.number_to_currency(p.cost / 100)
             ])
     form = render('volunteer/accept.mako')
     return htmlfill.render(form, defaults)