def designer_add(): page = Page(request.form.get('title'), request.form.get('content'), bool(request.form.get('feed')), bool(request.form.get('active'))) if not page.is_valid_model(): return jsonify({ "result": "error", "field": "", "message": "Unknown Error" }), 200 if len(page.get_title()) == 0: return jsonify({ "result": "error", "field": "title", "message": "Title cannot be empty!" }), 200 if page.is_there_any_with_title(page.get_title()): return jsonify({ "result": "error", "field": "title", "message": "Title has to be unique!" }), 200 page.save_to_db() return jsonify({"result": "ok", "field": "title", "message": ""}), 200
def designer_add(): page = Page(request.form.get('title'), request.form.get('content'), bool(request.form.get('feed')), bool(request.form.get('active'))) if not page.is_valid_model(): return jsonify({"result": "error", "field": "", "message": "Unknown Error"}), 200 if len(page.get_title()) == 0: return jsonify({"result": "error", "field": "title", "message": "Title cannot be empty!"}), 200 if page.is_there_any_with_title(page.get_title()): return jsonify({"result": "error", "field": "title", "message": "Title has to be unique!"}), 200 page.save_to_db() return jsonify({"result": "ok", "field": "title", "message": ""}), 200
def designer_edit(): page = Page(request.form.get('title'), request.form.get('content'), bool(request.form.get('feed')), bool(request.form.get('active')), uuid.UUID(request.form.get('id'))) if not page.is_valid_model(): return jsonify({"result": "error", "field": "", "message": "Unknown Error"}), 200 if len(page.get_title()) == 0: return jsonify({"result": "error", "field": "title", "message": "Title cannot be empty!"}), 200 page.sync_to_db() return jsonify({"result": "ok", "field": "title", "message": ""}), 200
def designer_edit(): page = Page(request.form.get('title'), request.form.get('content'), bool(request.form.get('feed')), bool(request.form.get('active')), uuid.UUID(request.form.get('id'))) if not page.is_valid_model(): return jsonify({ "result": "error", "field": "", "message": "Unknown Error" }), 200 if len(page.get_title()) == 0: return jsonify({ "result": "error", "field": "title", "message": "Title cannot be empty!" }), 200 page.sync_to_db() return jsonify({"result": "ok", "field": "title", "message": ""}), 200