Example #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')
Example #2
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')
Example #3
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')
Example #4
0
    def _new(self):
        results = self.form_result['ceiling']

        c.ceiling = Ceiling(**results)
        meta.Session.add(c.ceiling)
        meta.Session.commit()

        h.flash("Ceiling created")
        redirect_to(action='view', id=c.ceiling.id)
Example #5
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')
Example #6
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)
Example #7
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)
Example #8
0
    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)
Example #9
0
    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)
Example #10
0
 def __before__(self, **kwargs):
     c.product_categories = ProductCategory.find_all()
     c.ceilings = Ceiling.find_all()
Example #11
0
 def special_cases(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/special_cases.mako')
Example #12
0
 def index(self):
     c.can_edit = True
     c.ceiling_collection = Ceiling.find_all()
     return render('/ceiling/list.mako')
Example #13
0
 def validate_python(self, values, state):
     ceiling = Ceiling.find_by_name(values['ceiling']['name'])
     if ceiling != None and ceiling != c.ceiling:
         message = "Duplicate Ceiling name"
         error_dict = {'ceiling.name': "Ceiling name already in use"}
         raise Invalid(message, values, state, error_dict=error_dict)
Example #14
0
 def view(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/view.mako')
Example #15
0
 def validate_python(self, values, state):
     ceiling = Ceiling.find_by_name(values['ceiling']['name'])
     if ceiling != None and ceiling != c.ceiling:
         message = "Duplicate Ceiling name"
         error_dict = {'ceiling.name': "Ceiling name already in use"}
         raise Invalid(message, values, state, error_dict=error_dict)
Example #16
0
 def view(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/view.mako')
Example #17
0
 def special_cases(self, id):
     c.ceiling = Ceiling.find_by_id(id)
     return render('/ceiling/special_cases.mako')
Example #18
0
 def index(self):
     c.can_edit = True
     c.ceiling_collection = Ceiling.find_all()
     return render('/ceiling/list.mako')
Example #19
0
 def __before__(self, **kwargs):
     c.product_categories = ProductCategory.find_all()
     c.ceilings = Ceiling.find_all()