def add_deck():
    title = request.form['title']
    content = request.form['content']
    slug = slugify(content)
    print("adding deck with slug "+slug+" and title "+title)
#    db.engine.execute('insert into decks (slug, title, slides) values (?, ?, ?)',
#               [slug, request.form['title'], request.form['content']])
    deck = Deck(title, content)
    db.session.add(deck)
    db.session.commit()
    #test whether the deck has been saved correctly

    deck_gotten_back_from_the_database = Deck.query.filter_by(slug=slug).first()
    assert(title==deck_gotten_back_from_the_database.title)
    print "#### deck saved: ", deck.slides, type(deck)
#    return redirect(url_for('list_decks'))
    return redirect('/'+slug)
 def __init__(self, title, slides):
     self.title = title
     self.slides = slides
     self.slug = slugify(slides)
     self.pic = request_a_new_picture_url_from_unsplash(filter="")
 def __init__(self, title, slides):
     self.title = title
     self.slides = slides
     self.slug = slugify(slides)