def post(self): o = ObjectDict() o.title = self.get_argument('title', None) o.slug = self.get_argument('slug', None) o.content = self.get_argument('content', None) if not (o.title and o.slug and o.content): self.flash_message('Please fill the required field', 'error') self.render('doc.html', doc=o) return doc = Document(**o) db.session.add(doc) db.session.commit() self.reverse_redirect('dashboard')