def process_form(self, wtf, **kwargs): true_key = wtf.pkey.data.replace("_", "/") result = database.delete_article(true_key) if msg.is_good(result): return msg.success('Article deleted.', return_def="page_admin_main") return result
def process_form(self, wtf, pkey=None): group_name = wtf.group_name.data page_name = wtf.page_name.data key = database.build_key(group_name, page_name) result = database.upsert_article(key, wtf) if msg.is_good(result): return msg.success('Article saved.') return result
def login(): error = None if request.method == 'POST': this_user = database.check_login(request.form, bcrypt) if msg.is_good(this_user): login_user(this_user) msg.flash('Welcome, {}'.format(this_user.s_name)) return redirect(url_for('index')) else: msg.flash(this_user) return redirect(url_for('login')) return render_template('login.html', error=error)
def upsert_product(key, wtf): product = read_product(key) if msg.is_good(product): return update_product(product, wtf) return create_product(key, wtf)
def process_form(self, wtf, pkey=None, **kwargs): result = database.delete_product(pkey) if msg.is_good(result): return msg.success('Product deleted.', return_def="page_admin_main") return result
def process_form(self, wtf, **kwargs): # return database.create_testDocument() response = create_testDocument(wtf) if msg.is_good(response): response.return_def = "page_example_copy_fields" return response