def store(self, request: Request):
        post = Post.find(request.param('id'))

        post.title = request.input('title')
        post.body = request.input('body')

        post.save()

        return 'post updated'
Example #2
0
    def update(self, request: Request):
        post = Post.find(request.params.get('id'))

        post.category_id = request.input('category_id')
        post.content = request.input('content')
        post.title = request.input('title')
        post.slug = sluglify(request.input('title'))
        post.date = datetime.now()
        post.save()

        return 'Post updated !'
 def delete(self, request: Request):
     post = Post.find(request.param('id'))
     post.delete()
     return 'post deleted'
 def update(self, view: View, request: Request):
     post = Post.find(request.param('id'))
     return view.render('update', {'post': post})
Example #5
0
 def edit(self, view: View, request: Request):
     post = Post.find(request.params.get('id'))
     return view.render("posts/edit", {
         "categories": Category.get().all(),
         "post": post
     })