示例#1
0
 def post(self):
     new_message = Message(parent=messages_key('Messages'))
     new_message.populate(author = self.request.get('author'),
                          email = self.request.get('email'),
                          title = self.request.get('title'),
                          message = self.request.get('message'),
                          )
     new_message.put()
     
     message_query = Message.query(
         ancestor=messages_key('Messages')).order(-Message.date)
     messages = message_query.fetch(5) 
     
     template_values = {
         'name': CURRENT_USER_NAME,
         'messages': messages
     }
     
     template = JINJA_ENVIRONMENT.get_template('html/news.html')                   
     self.response.write(template.render(template_values))
示例#2
0
 def get(self):
     
     message_query = Message.query(
         ancestor=messages_key('Messages')).order(-Message.date)
     messages = message_query.fetch(5) 
    
     template_values = {
         'name': CURRENT_USER_NAME,
         'messages': messages
     }
     
     template = JINJA_ENVIRONMENT.get_template('html/news.html')                   
     self.response.write(template.render(template_values))