In addition to the answer supplied by @filippo-lauria, you should check for the existence of errors:
...
<label for="{{ form.firstname.id_for_label }}">First Name:</label>
{{ form.firstname }}
{% if form.firstname.errors %}
{{ form.firstname.errors }}
{% endif %}
...
As of Django 5.1, you will get template errors without this check if errors don't exist.