def edit(self, id): c.ceilings = Ceiling.find_all() c.ceiling = Ceiling.find_by_id(id) defaults = h.object_to_defaults(c.ceiling, 'ceiling') if c.ceiling.parent: defaults['ceiling.parent'] = c.ceiling.parent.id defaults['ceiling.products'] = [] for product in c.ceiling.products: defaults['ceiling.products'].append(product.id) if c.ceiling.available_from: defaults['ceiling.available_from'] = c.ceiling.available_from.strftime('%d/%m/%y') if c.ceiling.available_until: defaults['ceiling.available_until'] = c.ceiling.available_until.strftime('%d/%m/%y') form = render('/ceiling/edit.mako') return htmlfill.render(form, defaults)
def __before__(self, **kwargs): c.product_categories = ProductCategory.find_all() c.ceilings = Ceiling.find_all()
def new(self): c.ceilings = Ceiling.find_all() return render('/ceiling/new.mako')
def index(self): c.can_edit = True c.ceiling_collection = Ceiling.find_all() return render('/ceiling/list.mako')
def __before__(self, **kwargs): c.product_categories = ProductCategory.find_all() c.fulfilment_types = FulfilmentType.find_all() c.ceilings = Ceiling.find_all()