def remove(self, id): node = self._get_row(model.Event, id) if 1 == node.id: abort(403) self._check_access(node) fs = form.DeleteAcceptForm('event-remove') if request.POST: if fs.fields.save.id in request.POST: meta.Session.delete(node) meta.Session.commit() flash(u'Событие успешно удалено') c.is_full_redirect = True return self._redirect_to(controller='event', action='list', user=current_user().nickname) return redirect_to(node.url()) else: c.form = fs if is_ajax(): result = render('/util/delete_accept_partial.html') else: result = render('/util/delete_accept.html') return result
def remove(self, id): node = self._get_row(model.Article, id) fs = form.DeleteAcceptForm('article-remove') if request.POST: if fs.fields.save.id in request.POST: meta.Session.delete(node) meta.Session.commit() flash(u'Статья успешно удалена') if self.back_page() is not None: return redirect_to(**self.back_page()) return redirect_to('articles') else: c.form = fs if is_ajax(): result = render('/util/delete_accept_partial.html') else: result = render('/util/delete_accept.html') return result
def remove(self, id): node = self._get_row(model.Album, id) event_node = node.event self._check_access(event_node) fs = form.DeleteAcceptForm('album-remove') if request.POST: if fs.fields.save.id in request.POST: meta.Session.delete(node) meta.Session.commit() flash(u'Альбом успешно удален') if self.back_page(): return redirect_to(**self.back_page()) return redirect_to(event_node.url()) else: c.form = fs if is_ajax(): result = render('/util/delete_accept_partial.html') else: result = render('/util/delete_accept.html') return result