Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Update Query | Implement CRUD
Flask Intensive Course: Web Development with Python

bookUpdate Query

Let's talk about how to UPDATE elements, allowing you to edit specific parts of a recipe or update the entire recipe, completing the CRUD operations in Flask.

Remember how we easily accessed different fields of our model by using the following method:

Recipe.query.get(1).author

Just assign a new value to the attribute:

Recipe.query.get(1).author = "Monica"
db.session.commit()

This command is just to check the functionality of the previous two:

Recipe.query.filter_by(author="Monica").all()

You can edit other fields as well.

Now we know how to READ, CREATE, UPDATE, and DELETE.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 5

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Awesome!

Completion rate improved to 3.85

bookUpdate Query

Sveip for å vise menyen

Let's talk about how to UPDATE elements, allowing you to edit specific parts of a recipe or update the entire recipe, completing the CRUD operations in Flask.

Remember how we easily accessed different fields of our model by using the following method:

Recipe.query.get(1).author

Just assign a new value to the attribute:

Recipe.query.get(1).author = "Monica"
db.session.commit()

This command is just to check the functionality of the previous two:

Recipe.query.filter_by(author="Monica").all()

You can edit other fields as well.

Now we know how to READ, CREATE, UPDATE, and DELETE.

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 5
some-alt