def POST(self, name, action='view'): self.init_data(name, action) form = self.form_class() if form.validates(): active = True if form.get('active').value else False if not self.content: static_data = Static(position=int(form.get('position').value), name=form.get('name').value.lstrip('/'), label=form.get('label').value, title=form.get('title').value, content=form.get('content').value, active=active,) else: self.content.position=int(form.get('position').value) self.content.name=form.get('name').value.lstrip('/') self.content.label=form.get('label').value self.content.title=form.get('title').value self.content.content=form.get('content').value self.content.active=active static_data = self.content static_data.put() return web.seeother('/'+static_data.name, absolute=True) context['form'] = form return render_template('static_content.html', **context)