def get(self): if self.logged_in and self.current_user.admin: query = Query(kind="Tweet") tweets = query.fetch() tweets = reversed(sorted(tweets, key=lambda tweet: tweet.created)) tweet_list = [] for t in tweets: tweet_list.append({'message': t.message, 'priority': t.priority, 'created': t.created, 'sent': t.sent, 'id': t.key.id()}) sent_tweets = [t for t in tweet_list if t['sent'] != None] template_values = {'total': len(tweet_list), 'sent_tweets': len(sent_tweets), 'unsent_tweets': len(tweet_list) - len(sent_tweets), 'frequency': Configuration.get_instance().tweet_frequency, 'tweets': tweet_list} path = os.path.join(os.path.join(os.path.dirname(__file__), 'html'), '../../templates/admin/tweets.html') self.response.out.write(template.render(path, template_values)) else: self.redirect('/')
def get(self): if self.logged_in and self.current_user.admin: query = Query(kind="User") users = query.fetch() users = reversed(sorted(users, key=lambda user: user.created)) template_values = {'users': users} path = os.path.join(os.path.join(os.path.dirname(__file__), 'html'), '../../templates/admin/accounts.html') self.response.out.write(template.render(path, template_values)) else: self.redirect('/')
def get(self): if self.logged_in and self.current_user.admin: query = Query(kind="User") users = query.fetch() users = reversed(sorted(users, key=lambda user: user.created)) template_values = {'users': users} path = os.path.join( os.path.join(os.path.dirname(__file__), 'html'), '../../templates/admin/accounts.html') self.response.out.write(template.render(path, template_values)) else: self.redirect('/')
def get(self): if self.logged_in and self.current_user.admin: query = Query(kind="Tweet") tweets = query.fetch() tweets = reversed(sorted(tweets, key=lambda tweet: tweet.created)) tweet_list = [] for t in tweets: tweet_list.append({ 'message': t.message, 'priority': t.priority, 'created': t.created, 'sent': t.sent, 'id': t.key.id() }) sent_tweets = [t for t in tweet_list if t['sent'] != None] template_values = { 'total': len(tweet_list), 'sent_tweets': len(sent_tweets), 'unsent_tweets': len(tweet_list) - len(sent_tweets), 'frequency': Configuration.get_instance().tweet_frequency, 'tweets': tweet_list } path = os.path.join( os.path.join(os.path.dirname(__file__), 'html'), '../../templates/admin/tweets.html') self.response.out.write(template.render(path, template_values)) else: self.redirect('/')
def get_attacks(self): query = Query(Attack) query.ancestor(self) query.order('start_time') return query.run()
def get_attacks(self): query = Query(kind="Attack", ancestor=self.key) return query.fetch()