Kaydet (Commit) c6dc7089 authored tarafından Malcolm Tredinnick's avatar Malcolm Tredinnick

Refs #1834 -- Documented include_admin_script tag in admin interface. Thanks to

Matias Hermanrud Fjeld.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst 271083cf
...@@ -18,6 +18,19 @@ def class_name_to_underscored(name): ...@@ -18,6 +18,19 @@ def class_name_to_underscored(name):
return '_'.join([s.lower() for s in word_re.findall(name)[:-1]]) return '_'.join([s.lower() for s in word_re.findall(name)[:-1]])
def include_admin_script(script_path): def include_admin_script(script_path):
"""
Returns an HTML script element for including a script from the admin
media url.
Example usage::
{% include_admin_script js/calendar.js %}
could return::
<script type="text/javascript" src="/media/admin/js/calendar.js">
"""
return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path) return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path)
include_admin_script = register.simple_tag(include_admin_script) include_admin_script = register.simple_tag(include_admin_script)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment