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
This commit is contained in:
parent
271083cf7c
commit
c6dc7089a1
|
@ -18,6 +18,19 @@ def class_name_to_underscored(name):
|
|||
return '_'.join([s.lower() for s in word_re.findall(name)[:-1]])
|
||||
|
||||
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)
|
||||
include_admin_script = register.simple_tag(include_admin_script)
|
||||
|
||||
|
|
Loading…
Reference in New Issue