Ejemplo n.º 1
0
 def init_data(self, slug, post_id):
     try:
         self.post_id = int(post_id)
     except TypeError:
         self.post_id = 0
     self.post = Post.get_by_id(self.post_id)
     context['post'] = self.post
Ejemplo n.º 2
0
 def init_data(self, post_id, action):
     try:
         self.post_id = int(post_id)
         self.post = Post.get_by_id(self.post_id)
         context['page_path'] = '/post/'+self.post.slug+'-'+str(self.post.key().id())+'/edit'
     except TypeError:
         self.post_id = 0
         context['page_path'] = '/post/add'
     self.form = self.form_class()
     if action == 'edit':
         self.form.get('title').value = self.post.title
         self.form.get('body').value = self.post.body
         self.form.get('active').value = self.post.active