Ejemplo n.º 1
0
    def _delete(self, id):
        c.event = Event.find_by_id(id)
        meta.Session.delete(c.event)
        meta.Session.commit()

        h.flash("Event has been deleted.")
        redirect_to('index')
Ejemplo n.º 2
0
    def _delete(self, id):
        c.event = Event.find_by_id(id)
        meta.Session.delete(c.event)
        meta.Session.commit()

        h.flash("Event has been deleted.")
        redirect_to('index')
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    def new_proposals(self):
        for proposal in c.proposals:
            event = Event(type_id=1, proposal=proposal, publish=True, exclusive=False)
            meta.Session.add(event)
        meta.Session.commit()

        h.flash("Events successfully created from Proposals")
        redirect_to(action='index', id=None)
Ejemplo n.º 6
0
    def new(self):
        c.time_slots = TimeSlot.find_all()
        c.locations = Location.find_all()
        c.events = Event.find_all()

        form = render('/schedule/new.mako')
        object = { 'schedule': self.form_result }
        defaults = NewScheduleSchema().from_python(object)
        return htmlfill.render(form, defaults)
Ejemplo n.º 7
0
    def delete(self, id):
        """Delete the event

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.event = Event.find_by_id(id)
        return render('/event/confirm_delete.mako')
Ejemplo n.º 8
0
    def _new(self):
        results = self.form_result['event']

        c.event = Event(**results)
        meta.Session.add(c.event)
        meta.Session.commit()

        h.flash("Event created")
        redirect_to(action='index', id=None)
Ejemplo n.º 9
0
    def delete(self, id):
        """Delete the event

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.event = Event.find_by_id(id)
        return render('/event/confirm_delete.mako')
Ejemplo n.º 10
0
    def new(self):
        c.time_slots = TimeSlot.find_all()
        c.locations = Location.find_all()
        c.events = Event.find_all()

        form = render('/schedule/new.mako')
        object = {'schedule': self.form_result}
        defaults = NewScheduleSchema().from_python(object)
        return htmlfill.render(form, defaults)
Ejemplo n.º 11
0
    def _edit(self, id):
        event = Event.find_by_id(id)

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

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("The Event has been updated successfully.")
        redirect_to(action='index', id=None)
Ejemplo n.º 12
0
    def _edit(self, id):
        event = Event.find_by_id(id)

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

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("The Event has been updated successfully.")
        redirect_to(action='index', id=None)
Ejemplo n.º 13
0
    def edit(self, id):
        c.event = Event.find_by_id(id)
        if c.event.proposal:
            c.proposals.append(c.event.proposal)

        defaults = h.object_to_defaults(c.event, "event")
        defaults["event.type"] = c.event.type_id
        defaults["event.proposal"] = c.event.proposal_id

        form = render("/event/edit.mako")
        return htmlfill.render(form, defaults)
Ejemplo n.º 14
0
    def edit(self, id):
        c.event = Event.find_by_id(id)
        if c.event.proposal:
            c.proposals.append(c.event.proposal)

        defaults = h.object_to_defaults(c.event, 'event')
        defaults['event.type'] = c.event.type_id
        defaults['event.proposal'] = c.event.proposal_id

        form = render('/event/edit.mako')
        return htmlfill.render(form, defaults)
Ejemplo n.º 15
0
    def edit(self, id):
        c.event = Event.find_by_id(id)
        if c.event.proposal:
            c.proposals.append(c.event.proposal)

        defaults = h.object_to_defaults(c.event, 'event')
        defaults['event.type'] = c.event.type_id
        defaults['event.proposal'] = c.event.proposal_id

        form = render('/event/edit.mako')
        return htmlfill.render(form, defaults)
Ejemplo n.º 16
0
    def edit(self, id):
        c.time_slots = TimeSlot.find_all()
        c.locations = Location.find_all()
        c.events = Event.find_all()
        c.schedule = Schedule.find_by_id(id)

        defaults = h.object_to_defaults(c.schedule, 'schedule')
        defaults['schedule.time_slot'] = c.schedule.time_slot_id
        defaults['schedule.location'] = c.schedule.location_id
        defaults['schedule.event'] = c.schedule.event_id

        form = render('/schedule/edit.mako')
        return htmlfill.render(form, defaults)
Ejemplo n.º 17
0
    def edit(self, id):
        c.time_slots = TimeSlot.find_all()
        c.locations = Location.find_all()
        c.events = Event.find_all()
        c.schedule = Schedule.find_by_id(id)


        defaults = h.object_to_defaults(c.schedule, 'schedule')
        defaults['schedule.time_slot'] = c.schedule.time_slot_id
        defaults['schedule.location'] = c.schedule.location_id
        defaults['schedule.event'] = c.schedule.event_id

        form = render('/schedule/edit.mako')
        return htmlfill.render(form, defaults)
Ejemplo n.º 18
0
 def index(self):
     c.event_collection = Event.find_all()
     return render('/event/list.mako')
Ejemplo n.º 19
0
 def view(self, id):
     c.event = Event.find_by_id(id)
     return render('/event/view.mako')
Ejemplo n.º 20
0
 def view(self, id):
     c.event = Event.find_by_id(id)
     return render('/event/view.mako')
Ejemplo n.º 21
0
 def index(self):
     c.event_collection = Event.find_all()
     return render('/event/list.mako')