def getEvents(limit, pageNum, user): query = "WHERE dateStart >= :1 " # if not user.verified: # query+="AND verified = TRUE " query += "Limit " +(str)(limit*pageNum)+", " + (str)(limit) events = Event.gql(query, datetime.now()-timedelta(hours=2)).run() events = sorted(events, key=lambda event: event.dateStart) return events
def post(self): user = AppUser.getUser() eventName=getString("name", self) loc=getString("location", self) date = getDate("date", self) start=getDateTime("start",date, self) event = Event(creator=user,name=eventName, location=loc, dateStart=start) event.dateEnd=getDateTime("end",date, self) event.description=getString("description", self) event.host=getString("host", self) event.attending=0 event.put() if user.verified: event.verify(); # Auto-verified if the user is, and thanks the user. self.redirect('/?' + urllib.urlencode({'message':'''Thanks, yum!'''})) self.redirect('/?' + urllib.urlencode({'message':'''Event Created! You'll need to wait for someone to verify it.'''}))
def get(self): eventKey=self.request.path[7:] #Chops off the end of the request path to get the event key event=Event.get(eventKey) currentUser = AppUser.getUser() #if ((not event) or (not event.verified and not currentUser.verified)): # self.redirect('/?' + urllib.urlencode({'message':'Error: Event not found or could not be accessed.'})) if users.get_current_user(): url = users.create_logout_url(self.request.uri) url_linktext = 'Logout' else: url = users.create_login_url(self.request.uri) url_linktext = 'Login' template_values = { 'url': url, 'url_linktext': url_linktext, 'event' : event, 'currentUser' : currentUser } path=os.path.join(os.path.dirname(__file__), './templates/viewEvent.html') self.response.out.write(template.render(path, template_values))
def get(self): eventKey=self.request.path[6:] #Chops off the end of the request path to get the user key event=Event.get(eventKey) templateValues