Adding custom javascript to admin

13 views
Skip to first unread message

Larry Martell

unread,
Jan 21, 2014, 11:08:16 AM1/21/14
to django...@googlegroups.com
I have a model that I need to add some custom javascript processing to
its admin form, which is this:

class CategoryAdmin(admin.ModelAdmin):
radio_fields = {"data_path_ip": admin.HORIZONTAL}
list_display = ('name', 'event_path', 'data_path', 'file_spec',
'data_path_ip')
list_filter = ('name', 'event_path', 'data_path', 'file_spec',
'data_path_ip')
admin.site.register(Category, CategoryAdmin)

Where (i.e. in what template) would I put this js code in?

Larry Martell

unread,
Jan 21, 2014, 12:01:33 PM1/21/14
to django...@googlegroups.com
I found this: https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#overriding-admin-templates
so I created my own change_form.html, and I overrode
object-tools-items and put my js in there, but I'm not seeing it when
I go to the change form. Then, just as a test, I put it directly into
the real django change_form.html, but still nothing. Then to see if
that template is being used, I changed it - added data, created syntax
errors, but still, it had no effect. So it seems like that template
isn't being used at all. But the HTML sure looks like it came from
that template. Can anyone give me some direction here please.

Thanks!
-larry
Reply all
Reply to author
Forward
0 new messages