0

I am using mongoalchemy for the first time and it is proving a great tool. When I try to select objects from my database I cant get the value of those objects. This is my code as below (I am using it with flask):

class Password(db.Document):
    password = db.StringField()
    username = db.StringField()
    system = db.StringField()

@app.route('/search_password', methods=['GET', 'POST'])
def search_password():
    if request.method == 'GET':

        session = db.session
        passwords = session.query(Password)
        password = passwords.first()

        return render_template('search_for_passwords.html', passwords=password)
    elif request.method == 'POST':
        system = request.form['system'] 

So when I try to access the fields I cant because this is a document. So how do I get my fields back?

Ted Xu
  • 1,095
  • 1
  • 11
  • 20
Adnan
  • 113
  • 1
  • 4

1 Answers1

0

From the variable name looks to me that passwords is a list whereas password is a document, you may need to post your html template as well.

Ted Xu
  • 1,095
  • 1
  • 11
  • 20