Reference documentation:
* https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#overriding-
built-in-widget-templates
*
https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#templatessetting
This test case pares down the problem to the barest minimum example:
https://github.com/pydanny/django-widget-override-test-case
--
Ticket URL: <https://code.djangoproject.com/ticket/28088>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
Two things need changing:
* Change FORM_RENDERER to TemplateSettings:
https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#templatessetting
* Fix the template include paths so BASE_DIR is in there (django search
literally for django/forms/widgets…)
Closing this since it is in the documentation
(https://docs.djangoproject.com/en/1.11/ref/forms/renderers/#overriding-
built-in-widget-templates):
> 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/28088#comment:1>
Comment (by Florian Apolloner):
Diff to the referenced project to get it working:
```
diff --git a/sample/settings.py b/sample/settings.py
index 354d15a..3d87369 100644
--- a/sample/settings.py
+++ b/sample/settings.py
@@ -51,11 +51,12 @@ MIDDLEWARE = [
]
ROOT_URLCONF = 'sample.urls'
+FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': ['django/forms/templates', 'templates'],
+ 'DIRS': [BASE_DIR, 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
```
--
Ticket URL: <https://code.djangoproject.com/ticket/28088#comment:2>
Comment (by Daniel Greenfeld):
Perhaps specifying that `FORM_RENDERER =
'django.forms.renderers.TemplatesSetting'`?
Launching TSD 1.11 this week so am swamped, but I'll see if I can get a PR
in.
--
Ticket URL: <https://code.djangoproject.com/ticket/28088#comment:3>
Comment (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`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28088#comment:4>