#36302 closed Bug (duplicate)
Reusable form templates documentation is incomplete and results in an error when used as documented
Description ¶
The documentation (https://docs.djangoproject.com/en/5.1/topics/forms/#reusable-form-templates) for reusable form templates results in a server error.
- You create the template file
- You add and configure the CustomFormRenderer in settings.py
I've done both exactly as documented. I then used {{ form }} in a HTML template and got the following error from Django:
TemplateDoesNotExist at / django/forms/label.html
According to the docs though, "The example below will result in {{ form }} being rendered as the output of the form_snippet.html template." I am not sure which steps are missing from the documentation, but it seems that something's missing.
Change History (5)
comment:1 by , 2 days ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
comment:2 by , 41 hours ago
Owner: | set to |
---|---|
Status: | new → assigned |
follow-up: 5 comment:4 by , 32 hours ago
If there is another ticket easy, let me know, I will happy to work on it.
comment:5 by , 19 hours ago
Replying to Ahmed Nassar:
If there is another ticket easy, let me know, I will happy to work on it.
Hello Ahmed Nassar!
First of all, I’m sorry.
I should’ve double-checked before accepting this ticket — it turns out someone had already created a ticket regarding this issue.
From what I saw in the previous ticket, it seems like there was a discussion on the forum, and the conclusion was to keep the documentation as it is now.
To be honest, I personally feel that the documentation is a bit lacking, and a small note could make it better.
(Not everyone has a deep understanding of Django, and for beginners, small issues like this can lead to a very frustrating experience.)
Anyway, thank you for taking interest in this issue and trying to improve it!
I believe this issue can be resolved by adding
django.forms
to INSTALLED_APPS. It's a bit odd since django. forms isn't actually an app, but that seems to fix the problem. I encountered this issue myself, and I think it would be helpful if the documentation mentioned it—or even better, ifdjango.forms
were included in INSTALLED_APPS by default.However, these approaches are merely workarounds, so it would be great if the underlying issue could be resolved properly.