1
  1. In Admin for InlineForm there is a link that goes to the website, be default the text is (View on site).

  2. I want to add a similar link that goes to that model(that is inline) Detail Edit Page.

  3. Insert a JavaScript script in one of the Edit/Details Model Page in Admin

How can this be done ?

user3541631
  • 3,686
  • 8
  • 48
  • 115

1 Answers1

2

Adding JS and CSS to a models list_view and form_view pages are easy. Write a class Media inside the admin class for the respective model.

admin.py

class MyModelAdmin(admin.ModelAdmin):

    class Media:
        css = {
            "all": ("css/mycss.css",)
        }
        js = ("js/my_js.js",)

Place the javascript file inside /yourapp/static/yourapp/js/my_js.js and css inside /yourapp/static/yourapp/css/mycss.css

Nitheesh MN
  • 608
  • 8
  • 18
  • it is possible to add the link without Javascript ? how can css and javascript overwrite at all admin level the admin css – user3541631 Jan 12 '18 at 08:32
  • you can extend the admin templates check this https://stackoverflow.com/questions/6583877/how-to-override-and-extend-basic-django-admin-templates – Nitheesh MN Jan 12 '18 at 10:40