def post(self): if self.request.get('id') != '': page = db.get(self.request.get('id')) else: page = Page() if page: page.title = self.request.get('title') page.alias = self.request.get('alias') page.content = self.request.get('content') page.user = users.get_current_user() page.put() self.redirect('/admin/pages?id='+ str(page.key()))
def get(self): query = db.Query(Page) query = Page.all().sort('title') current_page_id = self.request.get('id') if current_page_id != '': page = db.get(current_page_id) else: page = Page() if id and page: form = PageForm(instance = page).as_p() else: form = PageForm().as_p() template_values = { 'usergreeting': helpers.get_user_greeting(), 'pages': query, 'metaform': form, 'currentpageid': current_page_id, } path = os.path.join(os.path.dirname(__file__), 'templates/ad_pages.html') self.response.out.write(template.render(path, template_values))