Ejemplo n.º 1
0
def form_boostrap(request):

    form = SigninForm(request)
    if form.validate_on_submit():
        return response.redirect('/done')

    return response.template('boostrap.html', form=form)
Ejemplo n.º 2
0
def form_validation(request):

    form = LoginForm(request)
    if form.validate_on_submit():
        return response.redirect('/good')

    return response.template('forms.html', form=form)
Ejemplo n.º 3
0
def form_test(request):

    form = TestForm(request)
    if form.validate_on_submit():
        return response.redirect('/account')

    return response.template('test.html', form=form)
Ejemplo n.º 4
0
def form_register(request):

    form = RegistrationForm(request)
    if form.validate_on_submit():
        return response.redirect('/good')

    return response.template('register.html', form=form)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
def redirect_hello_world(request):
    return response.redirect('/html')
Ejemplo n.º 10
0
def delete(request):
    cookies = CookieManager(options=options)
    del cookies['cookie_example']

    return response.redirect('/', cookies=cookies)
Ejemplo n.º 11
0
def save(request):
    cookies = CookieManager(options=options)
    cookies['cookie_example'] = 'value'
    cookies['cookie_example'].path = '/'

    return response.redirect('/', cookies=cookies)