Opened 4 days ago

Closed 40 hours ago

Last modified 19 hours ago

#36302 closed Bug (duplicate)

Reusable form templates documentation is incomplete and results in an error when used as documented

Reported by: Kevin Renskers Owned by: Ahmed Nassar
Component: Documentation Version: 5.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation (https://docs.djangoproject.com/en/5.1/topics/forms/#reusable-form-templates) for reusable form templates results in a server error.

  1. You create the template file
  2. 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 Antoliny, 2 days ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

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, if django.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.

Last edited 2 days ago by Antoliny (previous) (diff)

comment:2 by Ahmed Nassar, 41 hours ago

Owner: set to Ahmed Nassar
Status: newassigned

comment:3 by Sarah Boyce, 40 hours ago

Resolution: duplicate
Status: assignedclosed

Duplicate of #36044

comment:4 by Ahmed Nassar, 32 hours ago

If there is another ticket easy, let me know, I will happy to work on it.

Last edited 19 hours ago by Ahmed Nassar (previous) (diff)

in reply to:  4 comment:5 by Antoliny, 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!

Note: See TracTickets for help on using tickets.
Back to Top