FlaskFM project

I am about to finish the FLASKFM project but I am stuck in exercise 22.
This is about adding a song to the database by using the form provided.
When I enter any song, I should be able to see it on the list, however, they don’t appear.

Below is the code and not sure what is wrong with it:

@app.route(’/dashboard’, methods=[“GET”, “POST”])

def dashboard():
form = SongForm()
if request.method == ‘POST’ and form.validate():
new_song = None
new_song = Song(title = form.title, artist = form.artist, n = 1)
db.session.add(new_song)
db.session.commit()

This is the link to the exercise

[Flask FM]
(https://www.codecademy.com/paths/build-python-web-apps-flask/tracks/flask-sql-databases/modules/flask-sql-alchemy/projects/flask-database-music)

This topic is a duplicate of this topic. The ‘solution’ as of now is to disable form validation, but that is not the final resolution for closing the issue.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.