Opened 12 years ago

Closed 12 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: anatoly techtonik <techtonik@…> 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:

  1. Undocumented
  2. Module name is not convenient

I propose the following mechanism:

from codereview import customtags

django.template.add_library(customtags, default=True)

Change History (1)

comment:1 by Ramiro Morales, 12 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #17085. Seem like it isn't worth pushing things in this path, but rather aim for the greater refactoring proposed in #17093.

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