Complete the code to import the function needed to show flash messages in Flask.
from flask import Flask, render_template, [1]
The flash function is used to create flash messages in Flask.
Complete the code to flash a success message after a user logs in.
flash('Login successful!', category=[1])
The category 'success' is used to indicate a positive message.
Fix the error in the code to display flash messages in the template using Jinja2.
{% for message in get_flashed_messages(with_categories=[1]) %}
<div class="alert alert-{{ message[0] }}">{{ message[1] }}</div>
{% endfor %}Setting with_categories=True returns messages with their categories as tuples.
Fill both blanks to flash an error message and redirect to the login page.
flash('Invalid credentials', category=[1]) return [2](url_for('login'))
Use 'error' category for error messages and redirect to send user to another page.
Fill all three blanks to flash a message, redirect, and generate the URL for the home page.
flash('Welcome back!', category=[1]) return [2]([3]('home'))
redirect and url_for.Flash a success message, then redirect to the URL generated for 'home' using url_for.