#12772: Allow loading template tags by fully qualified python module path
---------------------------------+------------------------------------
Reporter: patrys | Owner: patrys
Type: New feature | Status: assigned
Component: Template system | Version: 1.2-beta
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by collinanderson):
Isn't there already a `{% load mylibrary from myapp %}` syntax?
I do feel like there's a ton of boilerplate for creating template tags. It
would be nice to cut down on this:
{{{
mkdir templatetags
touch templatetags/__init__.py
vi templatetags/thing_to_name.py
from django import template
register = template.Library()
@register.simple_tag
}}}
Could we allow any python module to register template tags, and then it's
up to you to be sure that gets imported before you use your template? So,
any python module could do something like this?
register = template.Library('name_of_library')
Though, it still doesn't solve name collisions.
--
Ticket URL: <https://code.djangoproject.com/ticket/12772#comment:30>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.0ea8a3c241dd83aa7dea9c491299d42c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.