def delete_news(id): """ Returns: """ if id > 0: news = News() news.set_id(id) news.load() news.delete() return render_template("content/news/news.html", news=News())
def edit_news(id): """ Returns: """ form = NewsEditorForm() news = News() if id > 0: news.set_id(id) news.load() if request.method == "GET": form.init_values(news) if request.method == "POST": if form.validate_on_submit(): news.prepare_form_input(request.form) news.save() else: form.get_error_messages() return render_template("content/news/edit_news.html", form=form)