[Answered ]-Django grappelli adding custom js to change_form

2👍

Create a subclass of ModelAdmin, and define the custom js in its Media class.

admin.py, in the same folder as the models.py that has Employer:

from django.contrib import admin
from models import Employer

class EmployerAdmin(admin.ModelAdmin):
    class Media:
        js = ("js/custom.js",) # This paths are appended to your MEDIA_URL setting

admin.site.register(Employer, EmployerAdmin)

Read more here

Leave a comment