def edit(self, id): # A person can only volunteer once c.form = "edit" c.volunteer = Volunteer.find_by_id(id) defaults = h.object_to_defaults(c.volunteer, "volunteer") form = render("/volunteer/edit.mako") return htmlfill.render(form, defaults)
def _edit(self, id): results = self.form_result["volunteer"] c.volunteer = Volunteer.find_by_id(id) for key in self.form_result["volunteer"]: setattr(c.volunteer, key, self.form_result["volunteer"][key]) meta.Session.commit() redirect_to(action="view", id=c.volunteer.id)
def pending(self, id): volunteer = Volunteer.find_by_id(id) volunteer.accepted = None volunteer.ticket_type = None meta.Session.commit() h.flash("Status Updated") redirect_to(action="index", id=None)
def edit(self, id): # A person can only volunteer once c.form = 'edit' c.volunteer = Volunteer.find_by_id(id) defaults = h.object_to_defaults(c.volunteer, 'volunteer') form = render('/volunteer/edit.mako') return htmlfill.render(form, defaults)
def _edit(self, id): results = self.form_result['volunteer'] c.volunteer = Volunteer.find_by_id(id) for key in self.form_result['volunteer']: setattr(c.volunteer, key, self.form_result['volunteer'][key]) meta.Session.commit() redirect_to(action='view', id=c.volunteer.id)
def pending(self, id): volunteer = Volunteer.find_by_id(id) volunteer.accepted = None volunteer.ticket_type = None meta.Session.commit() h.flash('Status Updated') redirect_to(action='index', id=None)
def view(self, id): c.volunteer = Volunteer.find_by_id(id) # We need to recheck auth in here so we can pass in the id if not h.auth.authorized( h.auth.Or(h.auth.is_same_zookeepr_user(c.volunteer.person.id), h.auth.has_organiser_role) ): # Raise a no_auth error h.auth.no_role() c.can_edit = h.auth.is_same_zookeepr_user(c.volunteer.person.id) c.volunteer = Volunteer.find_by_id(id) if c.volunteer is None: abort(404, "No such object") return render("volunteer/view.mako")
def view(self, id): c.volunteer = Volunteer.find_by_id(id) # We need to recheck auth in here so we can pass in the id if not h.auth.authorized( h.auth.Or(h.auth.is_same_zookeepr_user(c.volunteer.person.id), h.auth.has_organiser_role)): # Raise a no_auth error h.auth.no_role() c.can_edit = h.auth.is_same_zookeepr_user(c.volunteer.person.id) c.volunteer = Volunteer.find_by_id(id) if c.volunteer is None: abort(404, "No such object") return render('volunteer/view.mako')
def reject(self, id): volunteer = Volunteer.find_by_id(id) volunteer.accepted = False volunteer.ticket_type = None meta.Session.commit() c.volunteer = volunteer c.person = volunteer.person email(c.person.email_address, render("volunteer/response.mako")) h.flash("Status Updated and Rejection Email Sent") redirect_to(action="index", id=None)
def reject(self, id): volunteer = Volunteer.find_by_id(id) volunteer.accepted = False volunteer.ticket_type = None meta.Session.commit() c.volunteer = volunteer c.person = volunteer.person email(c.person.email_address, render('volunteer/response.mako')) h.flash('Status Updated and Rejection Email Sent') redirect_to(action='index', id=None)
def _accept(self, id): results = self.form_result volunteer = Volunteer.find_by_id(id) volunteer.ticket_type = results["ticket_type"] volunteer.accepted = True meta.Session.commit() c.volunteer = volunteer c.person = volunteer.person email(c.person.email_address, render("volunteer/response.mako")) h.flash("Status Updated and Acceptance Email Sent") redirect_to(action="index", id=None)
def _accept(self, id): results = self.form_result volunteer = Volunteer.find_by_id(id) volunteer.ticket_type = results['ticket_type'] volunteer.accepted = True meta.Session.commit() c.volunteer = volunteer c.person = volunteer.person email(c.person.email_address, render('volunteer/response.mako')) h.flash('Status Updated and Acceptance Email Sent') redirect_to(action='index', id=None)
def accept(self, id): volunteer = Volunteer.find_by_id(id) category = ProductCategory.find_by_name("Ticket") products = Product.find_by_category(category.id) defaults = {} if volunteer.ticket_type: defaults["ticket_type"] = volunteer.ticket_type.id c.products_select = [] c.products_select.append(["", "No Ticket"]) for p in products: if "Volunteer" in p.description: c.products_select.append([p.id, p.description + " - " + h.number_to_currency(p.cost / 100)]) form = render("volunteer/accept.mako") return htmlfill.render(form, defaults)
def accept(self, id): volunteer = Volunteer.find_by_id(id) category = ProductCategory.find_by_name('Ticket') products = Product.find_by_category(category.id) defaults = {} if volunteer.ticket_type: defaults['ticket_type'] = volunteer.ticket_type.id c.products_select = [] c.products_select.append(['', 'No Ticket']) for p in products: if 'Volunteer' in p.description: c.products_select.append([ p.id, p.description + ' - ' + h.number_to_currency(p.cost / 100) ]) form = render('volunteer/accept.mako') return htmlfill.render(form, defaults)