def news_delete(id: int): if not auth.is_authorized(): return redirect('/login') news = News.query.filter_by(id=id).first() if news.user_id != auth.get_user().id: abort(403) News.delete(news) return redirect('/news')
def delete(self, id): if not self._auth.is_authorized(): abort(401) news = News.query.filter_by(id=id).first() if news.user_id != self._auth.get_user().id: abort(403) News.delete(news) return jsonify({"deleted": True})