def delete_link(id): form = forms.DeleteLinkForm() link = Link.from_id(id) if link is None: return redirect('/404') if request.method == "GET": return render_template(Config.theme + "delete.jinja", app=Config, link=link, form=form) else: Link.delete_from_id(id) return redirect("/")
def edit_link(id): form = forms.SubmitLinkForm() link = Link.from_id(id, format=False) if link is None: return redirect('/404') if form.validate_on_submit(): pass for field, error in form.errors.iteritems(): for err in error: flash(err) taglist = [] for tag in link.tags: taglist.append(tag.text) link.tags_as_string = ','.join(taglist) return render_template(Config.theme + "edit.jinja", app=Config, link=link, form=form)