Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28088 closed Bug (invalid)

Overriding the built-in Django form widget HTML doesn't work

Reported by: Daniel Greenfeld Owned by: nobody
Component: Documentation Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


After multiple attempts following the documentation and peering into the source code, I can't override built-in widget's HTML.

Reference documentation:

This test case pares down the problem to the barest minimum example:

Change History (4)

comment:1 Changed 7 years ago by Florian Apolloner

Resolution: invalid
Status: newclosed

Two things need changing:

Closing this since it is in the documentation (

If you use the TemplatesSetting renderer, overriding widget templates works the same as overriding any other template in your project. You can’t override built-in widget templates using the other built-in renderers.

That said we will happily take PR improving the wording.

Last edited 7 years ago by Florian Apolloner (previous) (diff)

comment:2 Changed 7 years ago by Florian Apolloner

Diff to the referenced project to get it working:

diff --git a/sample/ b/sample/
index 354d15a..3d87369 100644
--- a/sample/
+++ b/sample/
@@ -51,11 +51,12 @@ MIDDLEWARE = [
 ROOT_URLCONF = 'sample.urls'
+FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
-        'DIRS': ['django/forms/templates', 'templates'],
+        'DIRS': [BASE_DIR, 'templates'],
         'APP_DIRS': True,
         'OPTIONS': {
             'context_processors': [
Last edited 7 years ago by Florian Apolloner (previous) (diff)

comment:3 Changed 7 years ago by Daniel Greenfeld

Perhaps specifying that FORM_RENDERER = 'django.forms.renderers.TemplatesSetting' in a much more obvious way?

Launching TSD 1.11 this week so am swamped, but I'll see if I can get a PR in.

Last edited 7 years ago by Daniel Greenfeld (previous) (diff)

comment:4 Changed 7 years ago by Tim Graham

#28102 is an accepted ticket for the documentation clarification about the need to put the full path to the built-in widget directories in DIRS.

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