On Aug 18, 2005, at 11:19 AM, David S. wrote:
Since the admin templates are auto-generated, how does any
JavaScript that you
link in with the js option actually get used?
The given JS URLs are added to the document's <head>; the can use
onload events to modify the page display. For example, you could
highlight a field as being extra-important doing something like::
class MyModel(meta.Model):
fields = (
meta.CharField("important_field", maxlength=100),
...
)
admin = meta.Admin(
js = ("http://example.com/js/somefile.js",)
)
... and then put this in ``somefile.js``::
addEvent(window, 'load', function() {
document.getElementById
('important_field').style.backgroundColor = 'yellow';
})
(``addEvent`` is defined in ``core.js`` which is included in every
admin page).
Jacob