def post(self): o = ObjectDict() o.title = self.get_argument('title', None) o.slug = self.get_argument('slug', None) o.avatar = self.get_argument('avatar', None) o.description = self.get_argument('description', None) o.fgcolor = self.get_argument('fgcolor', None) o.bgcolor = self.get_argument('bgcolor', None) o.header = self.get_argument('header', None) o.sidebar = self.get_argument('sidebar', None) o.footer = self.get_argument('footer', None) try: o.limit_reputation = int(self.get_argument('reputation', 0)) except: o.limit_reputation = 0 try: o.limit_role = int(self.get_argument('role', 0)) except: o.limit_role = 0 if not (o.slug and o.title and o.description): self.flash_message('Please fill the required field', 'error') self.render('node.html', node=o) return node = Node(**o) db.session.add(node) db.session.commit() self.reverse_redirect('dashboard')
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')