Beispiel #1
0
   def getEvents(self, request):
        print("Entered Get Events Portion")
        temp = request.collegeId
        temp2 = request.clubId
        date = request.date
        future_date = request.future_date
        

        print ("Future date is",future_date)
        if(temp2==None):
            print "No CLubId"
            collegeId = ndb.Key('CollegeDb',int(temp))
            events = Event.query(Event.collegeId==collegeId).order(-Event.start_time)
        elif(temp==None):
            print "No collegeID"
            clubId = ndb.Key('Club',int(temp2))
            events = Event.query(Event.club_id==clubId).order(-Event.start_time)

        else:
            print "Not None"
            collegeId = ndb.Key('CollegeDb',int(temp))
            clubId = ndb.Key('Club',int(temp2))
            events = Event.query(Event.collegeId==collegeId,Event.club_id==clubId).order(-Event.start_time)

        #All events have been obtained, check if date field is provided and take only those that have start date = req.date

        finalList = []
        if(future_date!=None):
           print ("Future Date part")
           for x in events:
              start_date = str(x.start_time.date())
              print("Retrieve start date",start_date)
              if(start_date >= future_date):
                 print ("Start Date is",start_date)
                 print ("Event to be added",x.title)
                 finalList.append(x)
           print("Returning all events from Final List")
           return Events(items=list(reversed([copyEventToForm(x) for x in finalList])))
        elif(date != None):
           for x in events:
              start_date = str(x.start_time.date())
              if(start_date == date):	
                 finalList.append(x)
           print("Returning all events from Final List")
           return Events(items=list(reversed([copyEventToForm(x) for x in finalList])))
        else:
           print("Returning all events from Events List")
           return Events(items=list(reversed([copyEventToForm(x) for x in events])))
Beispiel #2
0
 def GET(self):
     e = Events.Events()
     u = session_data["user"]["username"]
     events = e.get_all_events(u)
     return render.My_events(events)
Beispiel #3
0
 def GET(self):
     e = Events.Events()
     u = session_data["user"]["username"]
     events = e.get_events_that_can_be_updated(u)
     print(events)
     return render.Update(events)
Beispiel #4
0
 def POST(self, id):
     x = Events.Events()
     data = web.input()
     data.date_updated = datetime.datetime.now()
     x.update_event(id, data)
     raise web.seeother('/my-events')
Beispiel #5
0
 def POST(self, id):
     y = Events.Events()
     y.del_post(id)
     raise web.seeother('/my-events')
Beispiel #6
0
 def GET(self):
     e = Events.Events()
     y = e.recent_events()
     return render.RecentEvents(y)
Beispiel #7
0
 def GET(self):
     e = Events.Events()
     y = e.upcoming_events()
     return render.UpcomingEvents(y)
Beispiel #8
0
 def POST(self):
     data = web.input()
     data.username = session_data['user']['username']
     y = Events.Events()
     y.add_event(data)
     return "success"
Beispiel #9
0
 def GET(self):
     x = Events.Events()
     y = x.events_all()
     return render.All_events(y)