'Django FORM_RENDERER for frontend only
By default Django uses this setting determine where the form widgets come from:
FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
As we want all labels removed, and apply some overrides, it was changed to:
FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
This all works fine for the frontend. However, it renders the backend unusable as now all labels are removed there as well.
My question, how do I get Django to use the original setting for the admin?
Solution 1:[1]
It seems you cannot split up the frontend and backend. In the end, I ended up creating custom form/widget classes which I'm using all over the frontend.
The steps were:
- Keep an original copy of the Django forms in your templates folder
- Create a duplicate of each widget template you need in your own template folder
- Create a custom form class which overrides the template_name in init to force the use of your custom templates. This formclass can be treated as a mixing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | S.D. |
