def new(self): c.signed_in_person = h.signed_in_person() c.events = Event.find_all() c.schedule = Schedule.find_all() c.time_slot = TimeSlot.find_all() if not c.signed_in_person.registration: return render('/vote/no_rego.mako') c.votes = Vote.find_by_rego(c.signed_in_person.registration.id) defaults = {'vote.vote_value': 1} args = request.GET eventid = args.get('eventid', 0) revoke = args.get('revoke', 0) c.eventid = eventid if int(eventid) != 0 and c.votes.count() < 4 and revoke == 0: c.vote = Vote() c.vote.rego_id = c.signed_in_person.registration.id c.vote.vote_value = 1 c.vote.event_id = eventid meta.Session.add(c.vote) meta.Session.commit() if int(eventid) != 0 and int(revoke) != 0: c.vote = Vote.find_by_event_rego( eventid, c.signed_in_person.registration.id) meta.Session.delete(c.vote) meta.Session.commit() redirect_to('new') form = render('/vote/new.mako') return htmlfill.render(form, defaults)
def new(self): c.signed_in_person = h.signed_in_person() c.events = Event.find_all() c.schedule = Schedule.find_all() c.time_slot = TimeSlot.find_all() if not c.signed_in_person.registration: return render('/vote/no_rego.mako') c.votes = Vote.find_by_rego(c.signed_in_person.registration.id) defaults = { 'vote.vote_value': 1 } args = request.GET eventid = args.get('eventid',0) revoke = args.get('revoke',0) c.eventid = eventid if int(eventid) != 0 and c.votes.count() < 4 and revoke == 0: c.vote = Vote() c.vote.rego_id = c.signed_in_person.registration.id c.vote.vote_value = 1 c.vote.event_id = eventid meta.Session.add(c.vote) meta.Session.commit() if int(eventid) != 0 and int(revoke) != 0: c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id) meta.Session.delete(c.vote) meta.Session.commit() redirect_to('new') form = render('/vote/new.mako') return htmlfill.render(form, defaults)
def _revoke(self): args = request.GET eventid = int(args.get('eventid',0)) c.signed_in_person = h.signed_in_person() c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id) meta.Session.delete(c.vote) meta.Session.commit() redirect_to('new')
def revoke(self): """Delete the rego note GET will return a form asking for approval. POST requests will delete the item. """ args = request.GET eventid = int(args.get('eventid',0)) c.signed_in_person = h.signed_in_person() c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id) meta.Session.delete(c.vote) meta.Session.commit() form = render('/vote/delete.mako') return htmlfill.render(form, defaults) redirect_to('new')