Ejemplo n.º 1
0
    def post(self):
        jokeids=self.request.get('jokeids')
        checkJoke=JokeCheck.get_by_key_name('check')
        if not checkJoke:
            checkJoke=JokeCheck(key_name='check')
        checkJoke.lastCheckJoke=jokeids
        checkJoke.put()
        delids=self.request.get_all('delid')
#        for name,id in self.request.POST.multi:
#            if name=='jokeids':
#                jokeids.append(id)
#            if name=='delid':
#                delids.append(id)
#        jokeids=self.request.get('jokeids').split(',')
#
#        delids=self.request.get('delid').split(',')

#        ids=[]
#        for id in  jokeids:
#            if id not in delids:
#                ids.append(id)
#        js=[]
#        for j in Joke.get_by_key_name(ids):
#            #j=Joke.get_by_key_name(id)
#            j.isCheck=True
#            js.append(j)
#        db.put(js)

        deljoke=NewJoke.get_by_key_name(delids)
        if deljoke:
            db.delete(deljoke)
        self.redirect('/check')
Ejemplo n.º 2
0
 def get(self):
     checkJoke=JokeCheck.get_by_key_name('check')
     checkJoke=NewJoke.get_by_key_name(checkJoke.lastCheckJoke)
     if checkJoke:
         hahalist=NewJoke.all().filter('updateTime >',checkJoke.updateTime).order('updateTime').fetch(40)
     else:
         hahalist=NewJoke.all().order('updateTime').fetch(40)
     self.render('templates/check.html',{'hahalist':hahalist})