Exemplo n.º 1
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)
Exemplo n.º 2
0
 def dyntrack(self, id, track):
     u = identity.current.user
     ret = "Error"
     try:
         e = Event.get(id)
         if track == "true" and e not in u.events:
             try:
                 att = Attendance.selectBy(user=u, event=e)[0]
             except IndexError:
                 att = Attendance(user=u, event=e)
             att.planning_to_go = True
             ret = "Tracked"
         if track == "false" and e in u.events:
             atts = Attendance.selectBy(user=u, event=e)
             for att in atts:
                 att.destroySelf()
             ret = "Untracked"
     except SQLObjectNotFound:
         pass
     return ret