Ticket #2869: admin_js.patch
File admin_js.patch, 1.6 KB (added by , 18 years ago) |
---|
-
django/contrib/admin/templatetags/admin_modify.py
18 18 def include_admin_script(script_path): 19 19 """ 20 20 Returns an HTML script element for including a script from the admin 21 media url .21 media url (or other location if an absolute url is given). 22 22 23 23 Example usage:: 24 24 25 {% include_admin_script js/calendar.js%}25 {% include_admin_script "js/calendar.js" %} 26 26 27 27 could return:: 28 28 29 29 <script type="text/javascript" src="/media/admin/js/calendar.js"> 30 30 """ 31 32 return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path) 31 if not script_path.startswith('/') and '://' not in script_path: 32 script_path = '%s%s' % (settings.ADMIN_MEDIA_PREFIX, script_path) 33 return '<script type="text/javascript" src="%s"></script>' % script_path 33 34 include_admin_script = register.simple_tag(include_admin_script) 34 35 35 36 def submit_row(context): -
docs/model-api.txt
1206 1206 admin page in JavaScript or to provide "quick links" to fill in default values 1207 1207 for certain fields. 1208 1208 1209 If relative URLs are used, Django admin will automatically prepend these links 1210 with ``settings.ADMIN_MEDIA_PREFIX``. 1211 1209 1212 ``list_display`` 1210 1213 ---------------- 1211 1214