def publish(): id = int(request.form['postcard-id']) postcard = Postcard._byID(id) if postcard.deleted or postcard.published: abort(403) postcard.published = True db.session.commit() generate_jsonp() submit_link_to_postcard(postcard.id) send_gold_claim_message(postcard.id) enflair_user(postcard.user) flash('postcard published!') return redirect('/')
def publish(id): postcard = Postcard._byID(id) if postcard.deleted or postcard.published: abort(403) postcard.published = True db.session.commit() generate_jsonp() submit_link_to_postcard(postcard.id) send_gold_claim_message(postcard.id) enflair_user(postcard.user) if request.headers['X-Requested-With'] == 'XMLHttpRequest': return 'success!' else: flash('postcard published!') return redirect('/')
def delete(id): postcard = Postcard._byID(id) if postcard.deleted: abort(403) postcard.deleted = True db.session.commit() # clean up if necessary if postcard.published: remove_all_images(id) generate_jsonp() if request.headers.get('X-Requested-With') == 'XMLHttpRequest': return 'success!' else: flash('postcard deleted!') return redirect('/')