示例#1
0
    def _delete(self, id):
        c.funding_type = FundingType.find_by_id(id)
        meta.Session.delete(c.funding_type)
        meta.Session.commit()

        h.flash("Funding type has been deleted.")
        redirect_to('index')
示例#2
0
    def edit(self, id):
        c.funding_type = FundingType.find_by_id(id)

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

        form = render('/funding_type/edit.mako')
        return htmlfill.render(form, defaults)
示例#3
0
 def __before__(self, **kwargs):
     c.funding_types = FundingType.find_all()
     c.form_fields = {
       'funding.why_attend': 'Why would you like to attend ' + h.lca_info['event_name'],
       'funding.how_contribute': 'How do you contribute to the Open Source community',
       'funding.male': 'What is your gender',
       'funding.financial_circumstances': 'What are your financial circumstances',
     }
示例#4
0
    def delete(self, id):
        """Delete the funding type

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.funding_type = FundingType.find_by_id(id)
        return render('/funding_type/confirm_delete.mako')
示例#5
0
    def _new(self):
        results = self.form_result['funding_type']

        c.funding_type = FundingType(**results)
        meta.Session.add(c.funding_type)
        meta.Session.commit()

        h.flash("Funding type created")
        redirect_to(action='view', id=c.funding_type.id)
示例#6
0
    def _edit(self, id):
        funding_type = FundingType.find_by_id(id)

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

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("Funding type has been updated successfully.")
        redirect_to(action='view', id=id)
示例#7
0
 def __before__(self, **kwargs):
     c.funding_types = FundingType.find_all()
     c.form_fields = {
         'funding.why_attend':
         'Why would you like to attend ' + h.lca_info['event_name'],
         'funding.how_contribute':
         'How do you contribute to the Open Source community',
         'funding.male':
         'What is your gender',
         'funding.financial_circumstances':
         'What are your financial circumstances',
     }
示例#8
0
 def _to_python(self, value, state):
     funding_type = FundingType.find_by_id(int(value))
     if funding_type != None and funding_type.available():
       return funding_type
     else:
       return False
示例#9
0
 def index(self):
     c.funding_type_collection = FundingType.find_all()
     return render('/funding_type/list.mako')
示例#10
0
 def view(self, id):
     c.funding_type = FundingType.find_by_id(id)
     return render('/funding_type/view.mako')
示例#11
0
 def _to_python(self, value, state):
     funding_type = FundingType.find_by_id(int(value))
     if funding_type != None and funding_type.available():
         return funding_type
     else:
         return False