def store(self, view: View, request: Request): # сохранение обновленого содержимого поста в бд post = Post.find(request.param('id')) post.title = request.input('title') post.body = request.input('body') post.save() return 'post updated'
def store(self): post = Post.find(request().param('id')) post.title = request().input('title') post.body = request().input('body') post.save() return 'post updated'
def update(self, view: View, request: Request): post = Post.find(request.param('id')) post.title = request.input('title') post.body = request.input('body') post.save() return 'post updated'
def show(self, view: View, request: Request): post = Post.find(request.param('id')) return view.render('blog.post.show', { 'post': post })
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})
def single(self, view: View, request: Request): # открытие одного поста post = Post.find(request.param('id')) return view.render('single', {'post': post})
def delete(self): post = Post.find(request().param('id')) post.delete() return 'post deleted'
def update(self): post = Post.find(request().param('id')) return view('update',{'post': post})
def single(self): post = Post.find(request().param('id')) return view('single',{'post': post})
def delete(self, request: Request): post = Post.find(request.param('id')) post.delete() return 'post deleted'
def edit(self, view: View, request: Request): post = Post.find(request.param('id')) return view.render('edit', {'post': post})