Opened 13 years ago
Closed 13 years ago
#17368 closed Uncategorized (duplicate)
Document django.template.add_to_builtins() or provide a standard way to add template tags from view code
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Template system | Version: | 1.3 |
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 |
Description
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/
Currently, you need an obligatory {% load %}
tag in all you templates if you want to use custom application tags. That's inconvenient. There is a django.template.add_to_builtins()
function that accepts a string argument - a module name, which solves the problem. But this function is:
- Undocumented
- Module name is not convenient
I propose the following mechanism:
from codereview import customtags django.template.add_library(customtags, default=True)
Note:
See TracTickets
for help on using tickets.
Duplicate of #17085. Seem like it isn't worth pushing things in this path, but rather aim for the greater refactoring proposed in #17093.