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()
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()
def new(self): try: c.invoice_person = request.GET['person_id'] except: c.invoice_person = '' c.due_date = datetime.date.today().strftime("%d/%y/%Y") c.product_categories = ProductCategory.find_all() c.item_count = 0 return render("/invoice/new.mako")
def new(self): try: c.invoice_person = request.GET['person_id'] except: c.invoice_person = '' c.due_date = datetime.date.today().strftime("%d/%y/%Y") c.product_categories = ProductCategory.find_all() c.item_count = 0; return render("/invoice/new.mako")
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)
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)
def _to_python(self, value, state): return ProductCategory.find_by_id(value)