| | 484 | ``ModelAdmin`` media definitions |
|---|
| | 485 | -------------------------------- |
|---|
| | 486 | |
|---|
| | 487 | There are times where you would like add a bit of CSS and/or Javascript to |
|---|
| | 488 | the add/change views. This can be accomplished by using a Media inner class |
|---|
| | 489 | on your ``ModelAdmin``:: |
|---|
| | 490 | |
|---|
| | 491 | class ArticleAdmin(admin.ModelAdmin): |
|---|
| | 492 | class Media: |
|---|
| | 493 | css = { |
|---|
| | 494 | "all": ("my_styles.css",) |
|---|
| | 495 | } |
|---|
| | 496 | js = ("my_code.js",) |
|---|
| | 497 | |
|---|
| | 498 | Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules |
|---|
| | 499 | apply as `regular media definitions on forms`_. |
|---|
| | 500 | |
|---|
| | 501 | .. _regular media definitions on forms: ../newforms/#media |
|---|
| | 502 | |
|---|