Exemplo n.º 1
0
 def untrack(self, id, viewing="no"):
     u = identity.current.user
     try:
         e = Event.get(id)
         atts = Attendance.selectBy(user=u, event=e)
         for att in atts:
             att.destroySelf()
     except SQLObjectNotFound:
         flash("Event not found")
         redirect("/")
     if viewing == "no":
         util.redirect_previous()
     else:
         util.redirect("/events/%s" % e.id)
Exemplo n.º 2
0
 def track(self, id, viewing="no", planning=False, went=False, comment=None):
     u = identity.current.user
     try:
         e = Event.get(id)
         try:
             att = Attendance.selectBy(user=u, event=e)[0]
         except IndexError:
             att = Attendance(user=u, event=e)
         att.planning_to_go = planning
         att.attended = went
         att.comment = comment
     except SQLObjectNotFound:
         flash("Event not found")
         redirect("/")
     if viewing == "no":
         util.redirect_previous()
     else:
         util.redirect("/events/%s" % e.id)