I am having a ValueError (ValueError: too many values to unpack (expected 2)) in my Flask App. I came to know that this is because of flash that I am using to display a message with a category in it.
The problem occurs, when I try this
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for category, msg in messages %}
<div class="alert {{category}}">
<h1>{{category}}:</h1>
<h4>{{msg}}</h4>
</div>
{% endfor %}
{% endif %}
{% endwith %}
But if I just remove the category from the for loop it works, but the category doesn't!
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for msg in messages %}
<div class="alert {{category}}">
<h1>{{category}}:</h1>
<h4>{{msg}}</h4>
</div>
{% endfor %}
{% endif %}
{% endwith %}
Please help me