librelist archives

« back to archive

check the user login from database

check the user login from database

From:
peg kh
Date:
2014-12-29 @ 12:27
I want to check the name that user enter in form,IF it is the same as
database,in this case user can login.The table name is Contacts

I did something like this

@app.route('/login', methods=['GET','POST'])
def login():
  form = BaseForm(request.form)
  if request.method == 'POST':
     # Not working how to fix it?
     if request.form['name'] == Contacts.query.order_by(Contacts.name):
          return redirect(url_for('about'))

Re: [flask] check the user login from database

From:
Matthias Urlichs
Date:
2014-12-29 @ 12:50
Hi,

peg kh:
>      # Not working how to fix it?
>      if request.form['name'] == Contacts.query.order_by(Contacts.name):

By reading and understanding a couple of SQL tutorials, and/or by asking in
a sqlalchemy-related new-user forum.

This is not a Flask problem.

-- 
-- Matthias Urlichs