Esempio n. 1
0
 def get(self, post_id):
     post = Post.get_by_id(int(post_id))
     template_values = utils.initial_template(self.request)
     if post:
         template_values['post'] = post
         path = utils.template_path('templates/admin_edit_post.html')
         self.response.out.write(template.render(path, template_values))
     else:
         self.redirect('/error.html')
Esempio n. 2
0
 def get(self, post_id=None):
     template_values = utils.initial_template(self.request)
     if post_id:
         post = Post.get_by_id(int(post_id))
         if post:
             template_values['post'] = post
             path = os.path.join(os.path.dirname(__file__), 'templates/admin_post.html')
             self.response.out.write(template.render(path, template_values))
         else:
             self.redirect('/error.html')
     else:
         q = Post.all()
         q.order("-date")
         posts = q.fetch(5)
         template_values['posts'] = posts
         path = os.path.join(os.path.dirname(__file__), 'templates/admin_blog.html')
         self.response.out.write(template.render(path, template_values))
Esempio n. 3
0
 def get(self, post_id=None):
     template_values = utils.initial_template(self.request)
     if post_id:
         if template_values['is_admin']:
             self.redirect('/admin/blog/%s' % post_id)
         post = Post.get_by_id(int(post_id))
         if post and post.is_published:
             template_values['post'] = post
             path = os.path.join(os.path.dirname(__file__), 'templates/post.html')
             self.response.out.write(template.render(path, template_values))
         else:
             path = os.path.join(os.path.dirname(__file__), 'templates/error.html')
             self.response.out.write(template.render(path, {}))
     else:
         if template_values['is_admin']:
             self.redirect('/admin/blog')
         q = Post.all()
         q.filter("is_published =", True)
         q.order("-date")
         posts = q.fetch(5)
         template_values['posts'] = posts
         path = os.path.join(os.path.dirname(__file__), 'templates/blog.html')
         self.response.out.write(template.render(path, template_values))
Esempio n. 4
0
 def get(self):
     template_values = utils.initial_template(self.request)
     path = os.path.join(os.path.dirname(__file__), 'templates/admin_tools.html')
     self.response.out.write(template.render(path, template_values))
Esempio n. 5
0
 def get(self):
     template_values = utils.initial_template(self.request)
     if template_values['is_admin']:
         self.redirect('/admin/')
     path = os.path.join(os.path.dirname(__file__), 'templates/home.html')
     self.response.out.write(template.render(path, template_values))