def init_db(self): for param in PARAMS: if ParamApp.get(param) is None: db.session.add(ParamApp(key=param, value='')) db.session.commit() current_app.logger.info( "create homepage parameter register %s" % param)
def update(): for param in PARAMS: paramregister = ParamApp.get(param) paramregister.value = request.form.get(param, '') paramregister.save() file = request.files['file'] if file: filename = secure_filename(file.filename) pathfile = os.path.join(current_app.config['APP_IMG'], unidecode.unidecode(filename)) file.save(pathfile) return redirect(url_for('homepage.view'))
def update(): for param in PARAMS: paramregister = ParamApp.get(param) paramregister.value = request.form.get(param, '') paramregister.save() return redirect(url_for('paramapplication.view'))