def form_boostrap(request): form = SigninForm(request) if form.validate_on_submit(): return response.redirect('/done') return response.template('boostrap.html', form=form)
def form_validation(request): form = LoginForm(request) if form.validate_on_submit(): return response.redirect('/good') return response.template('forms.html', form=form)
def form_test(request): form = TestForm(request) if form.validate_on_submit(): return response.redirect('/account') return response.template('test.html', form=form)
def form_register(request): form = RegistrationForm(request) if form.validate_on_submit(): return response.redirect('/good') return response.template('register.html', form=form)
def form_register(request): form = RegistrationForm(request) if form.validate_on_submit(): print(form.username.data) return response.redirect('/success') return response.template('register.html', form=form)
def form_file(request): form = UploadForm(request) if form.validate_on_submit(): r_file = request.files['image'][0] image_dest = os.path.join('store', 'file.jpg') if r_file != '': with open(image_dest, 'wb') as jpeg_file: upload_store(jpeg_file, r_file) return response.redirect('/done') return response.template('file.html', form=form)
def form_signin(request): class SigninDB: username = '******' password = '******' signin_db = SigninDB() form = SigninForm(request, obj=signin_db) if form.validate_on_submit(): form.populate_obj(signin_db) print(signin_db.username) print(signin_db.password) if signin_db.password == 'miclave': # se genera la sesion y redirige return response.redirect('/account') else: form.password.errors.append('No es valido la clave') return response.template('signin.html', form=form)
def form_validation(request): form = LoginForm(request) if form.validate_on_submit(): return response.redirect('/good') return response.template('csrf.html', cookies=form.meta.cookies, form=form)
def redirect_hello_world(request): return response.redirect('/html')
def delete(request): cookies = CookieManager(options=options) del cookies['cookie_example'] return response.redirect('/', cookies=cookies)
def save(request): cookies = CookieManager(options=options) cookies['cookie_example'] = 'value' cookies['cookie_example'].path = '/' return response.redirect('/', cookies=cookies)