コード例 #1
0
    def _delete(self, id):
        c.ceiling = Ceiling.find_by_id(id)
        meta.Session.delete(c.ceiling)
        meta.Session.commit()

        h.flash("Ceiling has been deleted.")
        redirect_to('index')
コード例 #2
0
    def delete(self, id):
        """Delete the ceiling

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.ceiling = Ceiling.find_by_id(id)
        return render('/ceiling/confirm_delete.mako')
コード例 #3
0
    def _edit(self, id):
        ceiling = Ceiling.find_by_id(id)

        for key in self.form_result['ceiling']:
            setattr(ceiling, key, self.form_result['ceiling'][key])

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("The ceiling has been updated successfully.")
        redirect_to(action='view', id=id)
コード例 #4
0
ファイル: ceiling.py プロジェクト: PaulWay/zookeepr
    def edit(self, id):
        c.ceiling = Ceiling.find_by_id(id)

        defaults = h.object_to_defaults(c.ceiling, 'ceiling')

        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)
コード例 #5
0
    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)
コード例 #6
0
    def view(self, id):
        c.ceiling = Ceiling.find_by_id(id)
        c.specials = []
        SpecStruct = namedtuple('Special', 'id person_id reg_id fullname product is_paid diet special u18 notes')
        for product in c.ceiling.products:
            for invoice_item in product.invoice_items:
                if not invoice_item.invoice.status == 'Invalid':
                    person = invoice_item.invoice.person
                    rego = person.registration
                    c.specials.append(SpecStruct(
                        id=person.id,
                        person_id=person.id,
                        reg_id=rego.id,
                        fullname=person.fullname,
                        product=invoice_item.description,
                        is_paid=invoice_item.invoice.is_paid,
                        diet=rego.diet,
                        special=rego.special,
                        u18=not(rego.over18),
                        notes=rego.notes,
                    ))

        return render('/ceiling/view.mako')
コード例 #7
0
ファイル: ceiling.py プロジェクト: dtbell91/zookeepr
 def special_cases(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/special_cases.mako')
コード例 #8
0
ファイル: ceiling.py プロジェクト: dtbell91/zookeepr
 def view(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/view.mako')
コード例 #9
0
 def special_cases(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/special_cases.mako')
コード例 #10
0
 def view(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/view.mako')