Django Messages - Debug Tag Messages Not Showing On Template

I am going through the docs for Django Messages and have set up a basic form with some error messages and a debug message. The error messages are appearing but the debug one is not. I am not sure why the debug one is not and would appreciate some guidance. I did check the settings file and all 4 lines outlined in the docs are already included.

views.py

def register_request(request):
    if request.method == "POST":
        form = NewUserForm(request.POST)
        if form.is_valid():
            user = form.save()
            login(request, user)
            messages.success(request, "Registration successfull.")
            return redirect("messages_test:homepage")
        messages.error(request, "Unsuccessful registration. Invalid information.")
        messages.error(request, "Unsuccessful registration. Invalid information again.")
        messages.debug(request, "Debug message")
    form = NewUserForm()
    return render(request=request, template_name="messages_test/register.html", context={"register_form":form})

register.html

{% load static %}

<link rel="stylesheet" href="{% static 'messages_test/style.css' %}">

{% load crispy_forms_tags %}

<div class="container py-5">
    <h1>Register</h1>
    <form method="POST">
        {% csrf_token %}
        {{ register_form|crispy }}
        <button class="btn btn-primary" type="submit">Register</button>
    </form>
    {% if messages %}
    <ul class="messages">
        {% for message in messages %}
        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
        {% endfor %}
    </ul>
    {% endif %}
    <p class="text-center">If you already have an account, <a href="/login">Login</a> instead.</p>
</div>

enter image description here

I figured this out. The most basic way to solve this is to add

MESSAGE_LEVEL = 10

in settings.py. You can also import messages and add it this way

MESSAGE_LEVEL = messages.DEBUG

If you'd like to change the message level within a specific view you can add this above the message that you are adding

# messages.set_level(request, 10)
Back to Top