def getPosts(self, request): print("Entered Get Posts Portion") temp = request.collegeId temp2 = request.clubId print "temp" + str(temp) print "temp2" + str(temp2) if(temp2==None): print "None" collegeId = ndb.Key('CollegeDb',int(temp)) posts = Post.query(Post.collegeId==collegeId).order(-Post.timestamp) elif(temp==None): print "None" clubId = ndb.Key('Club',int(temp2)) posts = Post.query(Post.club_id==clubId).order(-Post.timestamp) else: print "Not None" collegeId = ndb.Key('CollegeDb',int(temp)) clubId = ndb.Key('Club',int(temp2)) posts = Post.query(Post.collegeId==collegeId,Post.club_id==clubId).order(-Post.timestamp) #pylist =[copyPostToForm(x) for x in posts] #print "the list" #print pylist return Posts(items=list(reversed([copyPostToForm(x) for x in posts])))
def getPosts(self, request): print("Entered Get Posts Portion") temp = request.collegeId temp2 = request.clubId print "temp2" + str(temp2) if(temp2==None): print "None" collegeId = ndb.Key('CollegeDb',int(temp)) posts = Post.query(Post.collegeId==collegeId) elif(temp==None): print "None" clubId = ndb.Key('Club',int(temp2)) posts = Post.query(Post.club_id==clubId) else: print "Not None" collegeId = ndb.Key('CollegeDb',int(temp)) clubId = ndb.Key('Club',int(temp2)) posts = Post.query(Post.collegeId==collegeId,Post.club_id==clubId) return Posts(items=[copyPostToForm(x) for x in posts])