Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:23:33+00:00 2026-05-26T03:23:33+00:00

I try to add my custom javascript to some change_form templates. Before having installed

  • 0

I try to add my custom javascript to some change_form templates.
Before having installed Grappelli, I could do that by extending
change_form.html of admin and creating sub folders under the templates
with my module names.

For example my tree hireachy was like :

+templates 
++admin_copies 
+++change_form.html (I have added extra js blocks) 
++admin 
+++employer 
++++employer 
+++++change_form.html 
++++employer_new 
+++++change_form.html

As you understand I have a model named “Employer”. I can add my custom
js methods under the change_form.html files.
However, this kind of inheritance cause javascript/breadcrumbs
problems with Grappelli.
How can I add simply my custom javascript functions for each model
separetly ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:23:34+00:00Added an answer on May 26, 2026 at 3:23 am

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to add Message.framework to my project frameworks directory. After that I compile
I try to add a class to a td-element using javascript with the internet
Suppose I have a custom collection class that provides some internal thread synchronization. For
I try to create a custom webpart page. I tried a book example that
I am adding some custom tabs to a jquery ui tab control. $(#tabs).tabs(add,#tabContent0,CLICK ME
I know xcode don't have radio Button so I try to add a custom
I'd wish to programmatically add a custom VariableResolver when JSF or anything like that
Often times, when I try to add my own custom PHP source codes to
I am building a custom magento module and i try to add a custom
Ok I have some custom Omniture code I need to add to a Drupal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.