コード例 #1
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
    def edit(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)

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

        form = render('/special_offer/edit.mako')
        return htmlfill.render(form, defaults)
コード例 #2
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
    def _delete(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)
        meta.Session.delete(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer has been deleted.")
        redirect_to('index')
コード例 #3
0
    def edit(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)

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

        form = render('/special_offer/edit.mako')
        return htmlfill.render(form, defaults)
コード例 #4
0
    def _delete(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)
        meta.Session.delete(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer has been deleted.")
        redirect_to('index')
コード例 #5
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
    def delete(self, id):
        """Delete the special_offer

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.special_offer = SpecialOffer.find_by_id(id)
        return render('/special_offer/confirm_delete.mako')
コード例 #6
0
    def _new(self):
        results = self.form_result['special_offer']

        c.special_offer = SpecialOffer(**results)
        meta.Session.add(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer created")
        redirect_to(action='view', id=c.special_offer.id)
コード例 #7
0
 def validate_python(self, values, state):
     special_offer = SpecialOffer.find_by_name(
         values['special_offer']['name'])
     if special_offer != None and special_offer != c.special_offer:
         message = "Duplicate Special Offer name"
         error_dict = {
             'special_offer.name': "Special Offer name already in use"
         }
         raise Invalid(message, values, state, error_dict=error_dict)
コード例 #8
0
    def delete(self, id):
        """Delete the special_offer

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.special_offer = SpecialOffer.find_by_id(id)
        return render('/special_offer/confirm_delete.mako')
コード例 #9
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
    def _edit(self, id):
        special_offer = SpecialOffer.find_by_id(id)

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

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("The special_offer has been updated successfully.")
        redirect_to(action='view', id=id)
コード例 #10
0
    def _edit(self, id):
        special_offer = SpecialOffer.find_by_id(id)

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

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("The special_offer has been updated successfully.")
        redirect_to(action='view', id=id)
コード例 #11
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
 def index(self):
     c.can_edit = True
     c.special_offer_collection = SpecialOffer.find_all()
     return render('/special_offer/list.mako')
コード例 #12
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
 def view(self, id):
     c.special_offer = SpecialOffer.find_by_id(id)
     c.registrations = SpecialRegistration.find_by_offer(id)
     return render('/special_offer/view.mako')
コード例 #13
0
ファイル: special_offer.py プロジェクト: CarlFK/zookeepr
    def validate_python(self, values, state):
        special_offer = SpecialOffer.find_by_name(values['special_offer']['name'])
        if special_offer != None and special_offer != c.special_offer:
	    message = "Duplicate Special Offer name"
	    error_dict = {'special_offer.name': "Special Offer name already in use"}
	    raise Invalid(message, values, state, error_dict=error_dict)
コード例 #14
0
 def index(self):
     c.can_edit = True
     c.special_offer_collection = SpecialOffer.find_all()
     return render('/special_offer/list.mako')
コード例 #15
0
 def view(self, id):
     c.special_offer = SpecialOffer.find_by_id(id)
     c.registrations = SpecialRegistration.find_by_offer(id)
     return render('/special_offer/view.mako')