コード例 #1
0
 def get(self):
     if self.user:
         input_article_id = self.request.get("article")
         article = Article.get_by_id(int(input_article_id))
         if self.user.key().id() == article.author:
             state = self.make_state()
             self.render('edit_article.html', 
                         user = self.user,  
                         article = article, 
                         title_form = article.title, 
                         body_form = article.body,
                         state = state)
         else:
             # Show message that user is not authorized to edit.
             self.render('message.html', message_edit_article_2 = True)
     else:
         # Prompt user to login.
         self.render('message.html', message_edit_article_1 = True)