From d9a2441c482a8b35da3e1cecc18b830d90015c6f Mon Sep 17 00:00:00 2001 From: Brian Rosner Date: Wed, 9 Jul 2008 18:09:38 +0000 Subject: [PATCH] newforms-admin: Added some documentation about media defintions in ModelAdmin classes. Fixed #7129. git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7873 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/admin.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/admin.txt b/docs/admin.txt index 08cafc2450..fbdd19bc90 100644 --- a/docs/admin.txt +++ b/docs/admin.txt @@ -481,6 +481,25 @@ with an operator: Performs a full-text match. This is like the default search method but uses an index. Currently this is only available for MySQL. +``ModelAdmin`` media definitions +-------------------------------- + +There are times where you would like add a bit of CSS and/or Javascript to +the add/change views. This can be accomplished by using a Media inner class +on your ``ModelAdmin``:: + + class ArticleAdmin(admin.ModelAdmin): + class Media: + css = { + "all": ("my_styles.css",) + } + js = ("my_code.js",) + +Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules +apply as `regular media definitions on forms`_. + +.. _regular media definitions on forms: ../newforms/#media + ``InlineModelAdmin`` objects ============================