How to load a custom JS file in Django admin home?

前端 未结 1 378
情歌与酒
情歌与酒 2020-12-01 18:18

I have a heavily customized Django admin where it\'s very simple to load a custom JS file for each of my ModelAdmins:

class MyModelAdmin(admin.ModelAdmin):
          


        
1条回答
  •  庸人自扰
    2020-12-01 18:43

    You can override templates/admin/index.html and add the JavaScript in the block extrahead:

    {% extends "admin/index.html" %}
    
    {% block extrahead %}
        {{ block.super }}
        # add a 
    
                                     
                  
提交回复
热议问题